iOS Client

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.payg.in/payment/api/order

Production URL:
https://paygapi.payg.in/payment/api/order

/create
 


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"
  },
 
}
  
 
 

 let parameters = [
 "OrderStatus":"Initiating",
 "Merchantkeyid": Merchantkeyid,
 "UniqueRequestId": uniqueId,
 "UserDefinedData": ["UserDefined1": ""],
 "RequestDateTime": todaydt,
 "RedirectUrl": RedirectUrl,
 "TransactionData": [
   "AcceptedPaymentTypes": "",
   "PaymentType": "",
   "SurchargeType": "",
   "SurchargeValue": "",
   "RefTransactionId": "",
   "IndustrySpecificationCode": "",
   "PartialPaymentOption": ""
 ],
 "OrderAmount": ModelPayment.tOrderAmt,
 "OrderType": "MOBILE",
 "OrderAmountData": [
   AmountTypeDesc": ModelPayment.tAmtTypeDec,
   "Amount": ModelPayment.tAmount
 ],
 "CustomerData": [
    "CustomerId": CustomerId,
    "CustomerNotes": ModelPayment.tCustomerNotes,
    "FirstName": ModelPayment.tFirstName,
    "LastName": ModelPayment.tLastname,
    "MobileNo": ModelPayment.tMobileNo,
    "Email": ModelPayment.tEmail,
    "EmailReceipt": ModelPayment.tEmailReceipt,
    "BillingAddress": ModelPayment.tBillingAddress,
    "BillingCity": ModelPayment.tBillingCity,
    "BillingState": ModelPayment.tBillingState,
    "BillingCountry": ModelPayment.tBillingCountry,
    "BillingZipCode": ModelPayment.tBillingZipCode,
    "ShippingFirstName" ModelPayment.tBillingShippingFirstName,
    "ShippingLastName": ModelPayment.tBillingShippingLastName,
    "ShippingAddress": ModelPayment.tShippingAddress,
    "ShippingCity": ModelPayment.tShippingCity,
    "ShippingState" ModelPayment.tShippingState,
    "ShippingCountry": ModelPayment.tShippingCountry,
    "ShippingZipCode": ModelPayment.tShippingZipCode,
    "ShippingMobileNo": ModelPayment.tShippingMobileNo
 ],
 "IntegrationData": [
    "UserName": ModelPayment.tUserName,
    "Source":  "MobileSDK",
   "IntegrationType":  "11",
    "HashData": ModelPayment.tHashData,
    "PlatformId": ModelPayment.tPlatformId
 ],
  "submit":  "Submit"
]  as [String : Any]

 let postData = try! JSONSerialization.data(withJSONObject: parameters, options: [])



 
      
         {
            "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":  ""
            }
         }
  
 

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 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.

Step 3: Order Details (API Request Parameters) 🔗

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":  ''
};
 
      
      

 
      
 let parameters = [
          "Merchantkeyid": Merchantkeyid,
          "OrderKeyId": orderKeyId,
          "PaymentTransactionId": null,
          "PaymentType": null,
] as [String : Any]
      
      

 
      
{
"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