You can use it on the front-end to open payment page or use the actual flow to create Payment Token
Step - 1 - Install dependency with npm package
$ npm install react-native-foloosi --save
Step - 2 - Usage
import Foloosi from'react-native-foloosi';var initData = { merchantKey:'YOUR_KEY',// public key customColor:'#AB34FD',// make payment page loading color as app color. // optional};Foloosi.initSDK(JSON.stringify(initData))
a. Make Payment with order object
You need to give the order id, title, description, currency code, order amount and customer details like name, email and mobile number.
// Customer field is optional.var orderData = { orderAmount:1.0,// in double format ##,###.## orderId:'orderId',// unique order id orderDescription:'order description',// any description. // optional currencyCode:'AED', customerUniqueReference:'customer reference id',// optional country:'ARE',// mandatory for ios postalCode:'000000',//optional state:'Dubai',//optional customer: { name:'Test', email:'[email protected]', mobile:'9876543210', address:'Test Adddddress',// optional city:'Test City',// optional },};
Use the line of code below to make payment with the order data
Foloosi.makePayment(JSON.stringify(orderData), (response) => {let { success, message, transaction_id } =JSON.parse(response);//success - type boolean//message - type string//transaction_id - type string if success is true otherwise it's null});