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
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
Please refer Order API Documentation for more details.
Use the below url to create an order in your (backend) server.
UAT URL:
https://uatapi.payg.in/payment/api/order
Production URL:
https://paygapi.payg.in/payment/api/order
Authorization: basic authentication with base64encoded
PayGAuthentication –
<MerchantAuthenticationKey> : <MerchantAuthenticationToken> :M: <MerchantKeyId>
{
"Merchantkeyid": "7963",
"UniqueRequestId": "f3f5b5c13f",
"UserDefinedData": {
"UserDefined1": ""
},
"RequestDateTime": "06232021",
"RedirectUrl": "https://payg.in",
"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/ PayG/ 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.payg.in\/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": ""
}
}
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 to payment process url using webview. Based on finish method inside webview can compare with the redirect url to navigate back.
UPI Link is for UPI payment. You can use either payment process URL or UPI based on your requirement.
You can get order details by passing the below request parameters.
Authorization: basic authentication with base64encoded PayGAuthentication – <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 }