Foloosi
Search…
React Native SDK
A React Native SDK plugin for making payments via Foloosi Payment Gateway. Fully supports Android and iOS.

Step - 1 - Install dependency with npm package

$ npm install react-native-foloosi --save

Step - 2 - Usuage

1
import Foloosi from 'react-native-foloosi';
2
3
// To initialize the SDK add the below line of code with the public key you retrieved from Foloosi merchant panel. If you don't have a public key create new one.
4
5
Foloosi.initSDK('YOUR_KEY');
Copied!

Step - 3 - Create Order Data Object with necessary inputs

You need to give the order id, title, description, currency code, order amount and customer details like name, email, mobile number. while creating order in Foloosi.
1
// Customer field is optional.
2
var orderData = {
3
orderAmount: 1.0, // in double format ##,###.##
4
customColor: '#AB34FD', // make payment page loading color as app color. // optional
5
orderId: 'orderId', // unique order id
6
orderDescription: 'order description', // any description. // optional
7
currencyCode: 'AED',
8
customerUniqueReference: 'customer reference id', // optional
9
country: 'ARE', // mandatory for ios
10
postalCode: '000000', //optional
11
state: 'Dubai', //optional
12
customer: {
13
name: 'Test',
14
15
mobile: '9876543210',
16
address: 'Test Adddddress', // optional
17
city: 'Test City', // optional
18
},
19
};
Copied!

Step - 4 - Make Transaction with Foloosi

a. Use the below line of code to make the payment with the order data you created in Step - 3
1
Foloosi.makePayment(JSON.stringify(orderData), (response) => {
2
let { success, message, transaction_id } = JSON.parse(response);
3
//success - type boolean
4
//message - type string
5
//transaction_id - type string if success is true otherwise it's null
6
});
Copied!
b. Use the below line of code to make the payment with the order data reference token
1
Foloosi.makePaymentWithReferenceToken('REFERENCE_TOKEN', (response) => {
2
let { success, message, transaction_id } = JSON.parse(response);
3
//success - type boolean
4
//message - type string
5
//transaction_id - type string if success is true otherwise it's null
6
});
Copied!