A library providing Esewa payment integration to react native applications
npm install rn-esewaA library providing esewa payment integration to react native applications
> :warning: For IOS development
> Please add following postinstall script to package.json
>
> This verifies and select the suitable esewa sdk of IOS for your environment.
>
> ``"postinstall": "sh node_modules/rn-esewa/scripts/select_esewa_ios_build.sh"``
>
> :warning: For Android development
> Please add following code to project level build.gradle
>
> `
> allprojects {
> repositories {
> ...
> maven {
> url = uri("https://maven.pkg.github.com/sapkotamadhusudan/rn-esewa")
> credentials {
> username = "public"
> password = "\u0067hp_6g5exZNHoyx0TlQkEEeMpC4gT7aKhv3hiPHq"
> }
> }
> }
> }
>
`sh
npm install rn-esewa
or
yarn add rn-esewa
`
`js
import eSewaPaymentSDK, { eSewaOptions, eSewaPaymentResponse } from 'rn-esewa';
const options = {
isDevelopment: true,
clientId:
clientSecret:
productId: new Date().getTime().toString(),
productName: 'Payment for RN-Esewa Module',
productPrice: '1',
callbackUrl: 'https://your-backend-api.com',
};
const paymentCallback = (response: eSewaPaymentResponse) => {
const { completed, proofOfPayment, didCancel, errorMessage } = response;
if (completed) {
console.debug('ProofOfPayment', proofOfPayment);
} else if (didCancel) {
console.info('Payment is canceled by user');
} else {
console.error(
Could not complete the payment due to ${
errorMessage || 'an unknown error'
}
);
}
};
eSewaPaymentSDK.initiatePayment(options, paymentCallback);
``
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT