1.0.10 • Published 6 years ago
react-native-payfort-sdk v1.0.10
react-native-payfort-sdk
Getting started
$ npm install react-native-payfort-sdk --save
Mostly automatic installation
$ react-native link react-native-payfort-sdk
Add library to each platform
iOS
- Extract this folder.
- Drag the
PayFortSDK.framework&PayFortSDK.bundletoFrameworksin Project Navigator. - Create a new group
Frameworksif it does not exist: Choose Create groups for any added folders. Make Sure to select Copy files if needed. - Set
-ObjCin the Other Linker Flags in theTarget→Build SettingsTab. - For Swift Projects Don’t forget to add the
#importto theBridging-Header.h
Android
- Extract this folder.
- In Android Studio, choose
File→New→New Modulethen selectImport .JAR\.AAR Package. - In the next step, find to the path of .aar file in library folder and press
Finish.
Usage
First, you have to read the document from Payfort carefully
import RNReactNativePayfortSdk from 'react-native-payfort-sdk';
let data = {};
data['access_code'] = 'abcdxyzqwerty'; // require field
data['merchant_identify'] = 'poilkjyhm'; // require field
data['request_phrase'] = 'tgbvfe'; // require field
data['customer_email'] = 'v@example.com'; // require field
data['currency'] = 'USD'; // require field
data['amount'] = '10'; // require field
data['merchant_reference'] = '123456'; // require field
data['customer_name'] = 'Glenn';
data['customer_ip'] = '27.79.60.231';
data['payment_option'] = 'VISA';
data['order_description'] = 'Order for testing';
RNReactNativePayfortSdk.openPayfort(data, (response) => {
console.log(response);
}, (message) => {
// Message in case payment is failure or cancel
});