0.3.7 • Published 2 years ago

rn-esewa v0.3.7

Weekly downloads
4
License
MIT
Repository
github
Last release
2 years ago

rn-esewa

A 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"
         }
       }
    }
}

Installation

npm install rn-esewa

or

yarn add rn-esewa

Usage

    import eSewaPaymentSDK, { eSewaOptions, eSewaPaymentResponse } from 'rn-esewa';

    const options = {
        isDevelopment: true,
        clientId: <eSewa merchantId>,
        clientSecret: <eSewa merchantSecrect>,
        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);

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

0.3.0

2 years ago

0.2.1

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.7

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.0

2 years ago

0.1.2

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago