Comment on page
Initiate Payment
This Section briefs about how to initiate a payment !
Foloosi's Android SDK provides easy payment collections.
You can use it on the front-end to open payment page or use the actual flow to create Payment Token
We distribute our SDK from the Maven Central Repository. To begin with this SDK opens your build.gradle file of Module:app and adds the following dependency.
implementation 'com.foloosi:FoloosiSDK:2.0.20'
To initialize the SDK add the codes below with the merchant key (Taken from foloosi merchant panel). If you do not have a merchant key create a new one and customize the checkout page to your liking.
1
InitData initData = new InitData();
2
initData.setMerchantKey(merchantKey); //YOUR MERCHANT KEY
3
initData.setCustomColor(customColor); // SDK CUSTOM COLOR
4
5
FoloosiPay.init(this, initData);
Set and Implement our payment listener to receive payment results for every payment.
1
//Setting payment listener (paste this line after init() method)
2
FoloosiPay.setPaymentListener(this);
Important Note - You can Follow any one of the methods below to initiate payment widget.
You can create the OrderData or payment input with our OrderData Model class. Here you need to provide order id, title, description, currency code, order amount and customer details like name, email and mobile number.
1
OrderData orderData = new OrderData(); // Foloosi Order Data Model Class Instance
2
orderData.setOrderAmount(Double.parseDouble(amount)); // in double format ##,###.##
3
Random rand = new Random();
4
int orderId = rand.nextInt(100000);
5
orderData.setOrderId(String.valueOf(orderId)); // unique order id.
6
orderData.setOrderDescription("Mobile Phone"); // any description.
7
orderData.setCurrencyCode(currencyCode);
8
orderData.setCustomerUniqueReference(""); //Customer Unique Reference value should be email/mobile no/uniqueCustomer id from your DB
9
Customer customer = new Customer();
10
customer.setName("name");
11
customer.setEmail("[email protected]");
12
customer.setMobile("1234567890");
13
orderData.setCustomer(customer);
orderData.setCustomerUniqueReference("") value MUST be customer id/email/mobile number for saved card feature.
Now make payments with order data you created above.
FoloosiPay.makePayment(orderData);
post
https://api.foloosi.com/aggregatorapi/web/initialize-setup
Get Reference Token
Make the payment with order reference token.
String referenceToken = "Your Reference Token";
FoloosiPay.makePaymentWithReferenceToken(referenceToken);
- Request call must be on POST.
- This Api will be used to confirm the feature you are about to Use.
- For Saved Card Payment Method, You need to pass your customer unique details like email,etc. to customer_unique_identifier.
Post Request Body
customer_unique_identifier |
|
Foloosi Technologies Pvt Ltd.
Copyrights (c) 2022 Foloosi
Last modified 9mo ago