Android Client

Prerequisites


Android SDK Version: Minimum SDK 16 and upper


Android Studio Version: Supports 4.1.1 and upper


Language: Java


Download the SDK from below link


Download SDK Zip



Step 1: Create New Order (REST API)

Please refer Order API Documentation for more details.


Use the below url to create an order in your (backend) server.


UAT URL: https://uatapi.fastswiff.com/payment/api/order


Production URL: https://api.fastswiff.com/payment/api/order


/create



Authorization: basic authentication with base64encoded

FastSwiffAuthentication –
 <MerchantAuthenticationKey > : <MerchantAuthenticationToken > :M: <MerchantKeyId>
   
												
	
{{'{'}}
"Merchantkeyid":  "7963",
"UniqueRequestId":  "f3f5b5c13f",
"UserDefinedData": {{'{'}}
"UserDefined1":  ""
{{'}'}},
"RequestDateTime":  "06232021",
"RedirectUrl":  "https://fastswiff.com",
"TransactionData": {{'{'}}
"AcceptedPaymentTypes":  "",
"PaymentType":  "",
"SurchargeType":  "",
"SurchargeValue":  "",
"RefTransactionId":  "",
"IndustrySpecificationCode":  "",
"PartialPaymentOption":  ""
{{'}'}},
"OrderAmount":  "100",
"OrderType":  "",
"OrderAmountData": {{'{'}}
"AmountTypeDesc":  "3",
"Amount":  "2"
{{'}'}},
"CustomerData": {{'{'}}
"CustomerId":  "152433",
"CustomerNotes":  "amway product",
"FirstName":  "kanhaiya",
"LastName":  "dhaked",
"MobileNo":  "08619083450",
"Email":  "demo@gmail.com",
"EmailReceipt":  "true",
"BillingAddress":  "44 bhawar nagar semal",
"BillingCity":  "semla",
"BillingState":  "Rajasthan",
"BillingCountry":  "India",
"BillingZipCode":  "30202020",
"ShippingFirstName":  "yagyang",
"ShippingLastName":  "dhaked",
"ShippingAddress":  "44 bhawar nagar semal",
"ShippingCity":  "semla",
"ShippingState":  "Rajasthan",
"ShippingCountry":  "India",
"ShippingZipCode":  "30202020",
"ShippingMobileNo":  "08619083450"
{{'}'}},
"IntegrationData": {{'{'}}
"UserName":  "ranjith",
"Source":  "3213",
"IntegrationType":  "11",
"HashData":  "",
"PlatformId":  "1"
{{'}'}},

{{'}'}}
 
												
 
public static JSONObject generateJsonRequest(String merchantId, int uniqueRequestId, double orderAmount, String customerMobileNo, String redirectURL, String walletType) {{'{'}}
       JSONObject jsonObject = new JSONObject();

       try {{'{'}}
           jsonObject.put("OrderKeyId", null);
           jsonObject.put("MerchantKeyId", merchantId); // required field
           jsonObject.put("ApiKey", null);
           jsonObject.put("UniqueRequestId", uniqueRequestId); // required field
           jsonObject.put("OrderAmount", orderAmount); // required field
           jsonObject.put("OrderType", "MOBILE");
           jsonObject.put("OrderId", null);
           jsonObject.put("OrderStatus", "Initiating");
           jsonObject.put("OrderAmountData", null);
           jsonObject.put("ProductData", null);
           jsonObject.put("NextStepFlowData", null);
              //            jsonObject.put("TransactionData", null);// pass null if not passing any payment type
           // wallet type (Seamless integration)
           JSONObject jsonObjTransactionData = new JSONObject();
           //jsonObjTransactionData.put("PAYMENTTYPE", "");  // Wallet/UPI/CreditCard/DebitCard (This is seamless integration it will navigate to payment option directly without going to payment gateway page)
                   
                    //            JSONObject jsonObjWalletType = new JSONObject();
                     //            jsonObjWalletType.put("USERNAME", null);
                     //            jsonObjWalletType.put("WALLETTYPE", walletType); // "AirtelMoney/ AmazonPay/ FreeCharge/ ITZ/ JIOMONEY/ OLAMoney/ Oxigen/ PayTm/ PayCash/ FastSwiff/ PhonePe/ Payzapp/ YesWallet"
                     //            jsonObjWalletType.put("FIRSTNAME", null);
                     //            jsonObjWalletType.put("LASTNAME", null);
                     //            jsonObjTransactionData.put("WALLET", jsonObjWalletType);
           jsonObject.put("TransactionData", jsonObjTransactionData); // new one
           // add customer info
           JSONObject jsonObjCustomer = new JSONObject();
           jsonObjCustomer.put("CustomerId", "");
           jsonObjCustomer.put("CustomerNotes", "");
           jsonObjCustomer.put("FirstName", "");
           jsonObjCustomer.put("LastName", "");
           jsonObjCustomer.put("MobileNo", customerMobileNo); // its required (new change)
           jsonObjCustomer.put("Email", "");
           jsonObjCustomer.put("EmailReceipt", false);
           jsonObjCustomer.put("BillingAddress", "");
           jsonObjCustomer.put("BillingCity", "");
           jsonObjCustomer.put("BillingState", "");
           jsonObjCustomer.put("BillingCountry", "");
           jsonObjCustomer.put("BillingZipCode", "");
           jsonObjCustomer.put("ShippingFirstName", "");
           jsonObjCustomer.put("ShippingLastName", "");
           jsonObjCustomer.put("ShippingAddress", "");
           jsonObjCustomer.put("ShippingCity", "");
           jsonObjCustomer.put("ShippingState", "");
           jsonObjCustomer.put("ShippingCountry", "");
           jsonObjCustomer.put("ShippingZipCode", "");
           jsonObjCustomer.put("ShippingMobileNo", "");

           jsonObject.put("CustomerData", jsonObjCustomer);

           // add user defined data
           JSONObject jsonObjUserDefined = new JSONObject();
           for (int i = 1; i = 20; i++) {{'{'}}
               jsonObjUserDefined.put("UserDefined" + i, "");
           {{'}'}}
           jsonObject.put("UserDefinedData", jsonObjUserDefined);

           // add integration data
           JSONObject jsonObjIntegrationData = new JSONObject();
           jsonObjIntegrationData.put("UserName", "");
           jsonObjIntegrationData.put("Source", "MobileSDK");
           jsonObjIntegrationData.put("IntegrationType", "11");
           jsonObjIntegrationData.put("HashData", "");
           jsonObjIntegrationData.put("PlatformId", "");
           jsonObject.put("IntegrationData", jsonObjIntegrationData);

           // add recurring billing data
           jsonObject.put("RecurringBillingData", "");
           jsonObject.put("CouponData", "");
           jsonObject.put("ShipmentData", "");
           jsonObject.put("RequestDateTime", "");
           jsonObject.put("RedirectUrl", redirectURL);
           jsonObject.put("Source", "");

       {{'}'}} catch (JSONException jsonException) {{'{'}}
           jsonException.printStackTrace();
       {{'}'}}
       return jsonObject;

{{'}'}}


												
	
    {{'{'}}
    "OrderKeyId": "210922M7963U253953851" ,
    "MerchantKeyId": 7963,
    "UniqueRequestId": "253953851",
    "OrderType": "MOBILE",
    "OrderAmount": 2,
    "OrderId": null,
    "OrderStatus": "Initiating",
    "OrderPaymentStatus": 0,
    "OrderPaymentStatusText": null,
    "PaymentStatus": 0,
    "PaymentTransactionId": null,
    "PaymentResponseCode": 0,
    "PaymentApprovalCode": null,
    "PaymentTransactionRefNo": null,
    "PaymentResponseText": null,
    "PaymentMethod": null,
    "PaymentAccount": null,
    "OrderNotes": null,
    "PaymentDateTime": null,
    "UpdatedDateTime": null,
    "PaymentProcessUrl": "https:\/\/uat.fastswiff.com\/payment\/payment?orderid=210922M7963U253953851",
    "OrderPaymentCustomerData": {{'{'}}
       "FirstName": "",
       "LastName": null,
       "Address": null,
       "City": null,
       "State": null,
       "ZipCode": null,
       "Country": null,
       "MobileNo": "8141129465",
       "Email": "",
       "UserId": null,
       "IpAddress": null
    {{'}'}},
    "UpiLink": null,
    "OrderPaymentTransactionDetail": null,
    "UserDefinedData": {{'{'}}
       "UserDefined1": "",
       "UserDefined2": "",
       "UserDefined3": "",
       "UserDefined4": "",
       "UserDefined5": "",
       "UserDefined6": "",
       "UserDefined7": "",
       "UserDefined8": "",
       "UserDefined9": "",
       "UserDefined10": "",
       "UserDefined11": "",
       "UserDefined12": "",
       "UserDefined13": "",
       "UserDefined14": "",
       "UserDefined15": "",
       "UserDefined16": "",
       "UserDefined17": "",
       "UserDefined18": "",
       "UserDefined19": "",
       "UserDefined20": ""
       {{'}'}}
 {{'}'}}
     
												




Step 2: Payment process url for checkout

Once your order is created successfully, Then, you will get payment process url and UPI link in response. This payment url is used to redirect to actual payment screen.


Developer can redirect either by using javascript or other programming languge.


This is a javascript example like window.location="Payment process url"


UPI Link is for UPI payment. You can use either payment process URL or UPI based on your requirement.



Step 3: Order Details (API request Parameters)

Authorization: basic authentication with base64encoded
FastSwiffAuthentication – 
<MerchantAuthenticationKey>:  <MerchantAuthenticationToken>:M: <MerchantKeyId>

												
	
{{'{'}}
"OrderKeyId": "210624M7963Ubd259588d4",
"MerchantKeyId":  "7963",
"PaymentType":  ''
{{'}'}};


												

public  static JSONObject generateOrderStatusRequest(String orderKeyId, String merchantId) {{'{'}}
    JSONObject jsonObject = new JSONObject();
    try {{'{'}}
        jsonObject.put("OrderKeyId", orderKeyId);
        jsonObject.put("MerchantKeyId", merchantId);
        jsonObject.put("PaymentTransactionId", null);
        jsonObject.put("PaymentType", null);

    {{'}'}} catch (JSONException jsonException) {{'{'}}
        jsonException.printStackTrace();
    {{'}'}}
    return jsonObject;
{{'}'}}

												
	

{{'{'}}
"OrderKeyId": "210624M7963Ubd259588d4",
"MerchantKeyId":  7963,
"UniqueRequestId":  "bd259588d4",
"OrderType":  "213",
"OrderAmount":  1.00,
"OrderId":  null,
"OrderStatus":  "0",
"OrderPaymentStatus":  0,
"OrderPaymentStatusText":  null,
"PaymentStatus":  0,
"PaymentTransactionId":  null,
"PaymentResponseCode":  0,
"PaymentApprovalCode":  null,
"PaymentTransactionRefNo":  null,
"PaymentResponseText":  null,
"PaymentMethod":  null,
"PaymentAccount":  null,
"OrderNotes":  null,
"PaymentDateTime":  null,
"UpdatedDateTime":  "6/24/2021 6:12:43 PM",
"PaymentProcessUrl":  null,
"OrderPaymentCustomerData":  null,
"UpiLink":  null
{{'}'}}

												
Note: Please check the payment status codes from this URL Payment Response codes Note: Please check the error codes from this URL Error codes
Tools

Select Color

Modes

light

light

dark

dark

Sidebar

Backgrounds

default

Default

bg-1

Bg-1

bg-2

Bg-2

bg-3

Bg-3

bg-4

Bg-4

bg-5

Bg-5

Box Design

default

Default

box-1

Box-1

box-2

Box-2

box-3

Box-3