1.0.0 • Published 3 years ago

react-native-imepay v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Sponsors


If you use this library on your commercial/personal projects, you can help us by raising an issue or sending a pull request.!

react-native-imepay

react-native wrapper for imepay. Especially designed for nepal

Getting started

Installation


If you are using react-native >= 0.60 you just need to do a simple:

yarn add react-native-imepay

Or if are using npm:

npm i react-native-imepay --save

After that, we need to install the dependencies to use the project on iOS(you can skip this part, if you are using this on Android).

Now run a simple: npx pod-install or cd ios && pod install. After that, you should be able to use the library on both Platforms, iOS and Android.

Then simply import:

In case of error on ios

use_frameworks! in your pod file.

Usage

import Imepay from 'react-native-imepay';

/**
 * @makePayment Function
 * @MERCHANT_CODE String
 * @MERCHANT_NAME String
 * @MERCHANT_TRANSACTION_RECORDING_URL String
 * @AMOUNT String
 * @REFERENCE_ID String
 * @MODULE String
 * @USERNAME String
 * @PASSWORD String
 * @Env String
 *
 * @return Promise
 * */

Imepay.makePayment(
  MERCHANT_CODE,
  MERCHANT_NAME,
  MERCHANT_TRANSACTION_RECORDING_URL,
  AMOUNT,
  REFERENCE_ID,
  MODULE,
  USERNAME,
  PASSWORD,
  (Env: 'Live' | 'Test')
);

Example

import Imepay from 'react-native-imepay';

// ...

const result = await Imepay.makePayment(
  'TEST',
  'TEST',
  'https://merchantname.com/merchant_transaction_recording_method',
  '200',
  'Reference Value',
  'TEST',
  'TEST',
  'TEST',
  'Live'
);

Response Format:
{
  responseCode: ''
  responseDescription: ''
  transactionId: ''
  customerMsisdn: ''
  amount: ''
  referenceId: ''
}

// Response Code 100:- Transaction successful.
// Response Code 101:- Transaction failed.

Support us by using this library

Contributing

License

MIT