Android SDK
The Foloosi Payments plugin allows you to accept credit card and debit card payments via Foloosi payment gateway.

Foloosi Android SDK Integration

Android Requirement

android {
defaultConfig {
minSdkVersion 21

Step - 1 - Add Dependency

We distribute our SDK from the Maven Central Repository. To begin with this SDK open your build.gradle file of Module:app and add the following dependency.
implementation 'com.foloosi:FoloosiSDK:2.0.13'

Step - 2 - Initialize SDK

To initialize the SDK add the below line of code with the merchant key you retrieved from foloosi merchant panel. If you don't have a merchant key create new one.
FoloosiPay.init(this, "Your Unique Merchant Key");

Step - 3 - Create Order Data Object with necessary inputs

You can create the order data 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, mobile number.
OrderData orderData = new OrderData(); // Foloosi Order Data Model Class Instance
orderData.setOrderAmount(Double.parseDouble(amount)); // in double format ##,###.##
Random rand = new Random();
int orderId = rand.nextInt(100000);
orderData.setCustomColor("#ab34fd"); // make payment page loading color as app color.
orderData.setOrderId(String.valueOf(orderId)); // unique order id.
orderData.setOrderDescription("Mobile Phone"); // any description.
orderData.setCustomerUniqueReference(""); //Customer Unique Reference value should be email/mobile no/uniqueCustomer id from your DB
Customer customer = new Customer();
customer.setEmail("[email protected]");

Important Note:-

*orderData.setCustomerUniqueReference("") value must be customer id/email/mobile no for use saved card feature.

Step - 4 - Implement Payment Listener

Set and Implement our payment listener to receive the payment result for the payment we going to make in Step - 5. Use the below code to obtain the payment result.
//Setting payment listener (paste this line after init() method)
public class ActDemoPay extends AppCompatActivity implements FPayListener {
public void onTransactionSuccess(String transactionId, String responseCode) {
// Success Callback
public void onTransactionFailure(String error, String transactionId, String responseCode) {
// Failure Callback.
public void onTransactionCancelled(String responseCode) {
// Transaction Cancelled by User

Step - 5 - Make Transaction with Foloosi

Note: call any one of the following method(a or b) to make payment.
a. Use the below line of code to make the payment with the order data you created in Step - 3
b. Use the below line of code to make the payment with the order data reference token
String referenceToken = "Your Reference Token";

Foloosi Log

You can enable / disable the SDK logs by using the below line of code. By default it will be disabled.
FoloosiLog.setLogVisible(true or false);

Proguard Rules

If you are using Proguard for your builds, modify the Proguard rule file:
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
-keepattributes JavascriptInterface
-keepattributes *Annotation*
-dontwarn com.foloosi.**
-keep class com.foloosi.** {*;}
-optimizations !method/inlining/*

Sample Payment Reference.

Please check this link for sample payment with above steps.