Step 1: Create New Order (REST API) 🔗

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

UAT URL: https://uatapiv2.payg.in/payment/api/order

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

/create


Authorization: basic authentication with base64encoded

PayGAuthentication –
<MerchantAuthenticationKey>:<MerchantAuthenticationToken>:M:<MID>
  
                  
                        
                           {
                              "MID": "3EMF9915EF35567",
                              "UniqueRequestId": "TEST512scx3",
                              "UserDefinedData": {
                                  "UserDefined1": ""
                              },
                              "ProductData": "{'PaymentReason':'OnlineOrder for OrderNo- 1234'}",
                              "RequestDateTime": "06232023",
                              "RedirectUrl": "https://payg.in",
                              "TransactionData": {
                                  "AcceptedPaymentTypes": "",
                                  "PaymentType": "",
                                  "SurchargeType": "",
                                  "SurchargeValue": "",
                                  "RefTransactionId": "",
                                  "IndustrySpecificationCode": "",
                                  "PartialPaymentOption": ""
                              },
                              "OrderAmount": "3",
                              "OrderType": "",
                              "OrderAmountData": {
                                  "AmountTypeDesc": "3",
                                  "Amount": "2"
                              },
                              "CustomerData": {
                                  "CustomerId": "123456",
                                  "CustomerNotes": "Mens clothing",
                                  "FirstName": "Ayush",
                                  "LastName": "Rane",
                                  "MobileNo": "7887673322",
                                  "Email": "ayushtesting12@gmail.com",
                                  "EmailReceipt": "true",
                                  "BillingAddress": "76, Sch. 115",
                                  "BillingCity": "Indore",
                                  "BillingState": "MP",
                                  "BillingCountry": "India",
                                  "BillingZipCode": "452011",
                                  "ShippingFirstName": "Ayush",
                                  "ShippingLastName": "Rane",
                                  "ShippingAddress": "76, Sch. 115",
                                  "ShippingCity": "Indore",
                                  "ShippingState": "MP",
                                  "ShippingCountry": "India",
                                  "ShippingZipCode": "452011",
                                  "ShippingMobileNo": "9987887733"
                              },
                              "IntegrationData": {
                                  "UserName": "Ayush",
                                  "Source": "3213",
                                  "IntegrationType": "",
                                  "HashData": "",
                                  "PlatformId": "1"
                              }
                          }  
 
         
 def orderCreate(self,post_data):
        #now = datetime.datetime.now()
        
        myfamily = {
            'Merchantkeyid':self.MerchantKeyId,
            'UniqueRequestId':PayGIntegration.get_random_string(10),
            'OrderAmount':post_data.get('OrderAmount'),
            'OrderType':post_data.get('OrderType'),
            "UserDefinedData" : {
                "UserDefined1" : ""    
            },
            "RequestDateTime":"",
            "RedirectUrl":"https://a2zfame.com",
            "TransactionData" : {
                "AcceptedPaymentTypes" : "Linus",
                "PaymentType" : 2011,
                "SurchargeType":"",
                "SurchargeValue":"",
                "RefTransactionId":"",
                "IndustrySpecificationCode":"",
                "PartialPaymentOption":""
            },
            'OrderAmountData':{
               "AmountTypeDesc":post_data.get('AmountTypeDesc'),
                "Amount":post_data.get('Amount')
            },
            "CustomerData":{
               "CustomerId":post_data.get('CustomerId'),
                "CustomerNotes":post_data.get('CustomerNotes'),
               "FirstName":post_data.get('FirstName'),
               "LastName":post_data.get('LastName'),
               "MobileNo":post_data.get('MobileNo'),
               "Email":post_data.get('Email'),
               "EmailReceipt":post_data.get('EmailReceipt'),
               "BillingAddress":post_data.get('BillingAddress'),
               "BillingCity":post_data.get('BillingCity'),
               "BillingState":post_data.get('BillingState'),
               "BillingCountry":post_data.get('BillingCountry'),
               "BillingZipCode":post_data.get('BillingZipCode'),
               "ShippingFirstName":post_data.get('ShippingFirstName'),
               "ShippingLastName":post_data.get('ShippingLastName'),
               "ShippingAddress":post_data.get('ShippingAddress'),
               "ShippingCity":post_data.get('ShippingCity'),
               "ShippingState":post_data.get('ShippingState'),
               "ShippingCountry":post_data.get('ShippingCountry'),
               "ShippingZipCode":post_data.get('ShippingZipCode'),
               "ShippingMobileNo":post_data.get('ShippingMobileNo'),
            },
            "IntegrationData":{
                "UserName":post_data.get("UserName"),
                "Source":post_data.get("Source"),
                "IntegrationType":post_data.get("IntegrationType"),
                "HashData":post_data.get("HashData"),
                "PlatformId":post_data.get("PlatformId"),
            }
        }

        message = self.AuthenticationKey+":"+self.AuthenticationToken+":M:"+self.MerchantKeyId
        message_bytes = message.encode('ascii')
        base64_bytes = base64.b64encode(message_bytes)
        base64_message = base64_bytes.decode('ascii')
        
        url = self.paymentURL+"/create"      
        payload = json.JSONEncoder().encode(myfamily);
        headers = {
        'content-type': "application/json",
        'authorization': "Basic "+base64_message,
        'cache-control': "no-cache",
        'postman-token': "d755d76a-eee0-437a-48f6-cd08297493f8"
        }

        response = requests.request("POST", url, data=payload, headers=headers)
        pprint.pprint("yagyang start")
        pprint.pprint(response.text)
        pprint.pprint("yagyang end")
        
        return json.loads(response.text)
        


      
         {
            "OrderKeyId": "93281250227M10404UTEST512scx3",
            "MerchantKeyId": 10121,
            "UniqueRequestId": "TEST512scx3",
            "OrderType": "PAYMENT",
            "OrderAmount": 3,
            "OrderId": null,
            "OrderStatus": null,
            "OrderPaymentStatus": 0,
            "OrderPaymentStatusText": null,
            "PaymentStatus": 0,
            "PaymentTransactionId": null,
            "PaymentResponseCode": 0,
            "PaymentApprovalCode": null,
            "PaymentReasonCode": null,
            "PaymentTransactionRefNo": null,
            "PaymentResponseText": null,
            "PaymentMethod": null,
            "PaymentAccount": null,
            "OrderRefundTransactionId": 0,
            "RefundPaymentResponseCode": 0,
            "RefundPaymentResponseText": null,
            "RefundDateTime": null,
            "CardType": null,
            "CardLevel": null,
            "OrderNotes": null,
            "PaymentDateTime": null,
            "UpdatedDateTime": null,
            "PaymentProcessUrl": "https://uat.payg.in/paymentv6/payment-form?OrderKeyId=93281250227M10404UTEST512scx3",
            "CustomerData": {
                "CustomerId": "123456",
                "CustomerNotes": "Mens clothing",
                "FirstName": "Ayush",
                "LastName": "Rane",
                "MobileNo": "7887673322",
                "Email": "ayushtesting12@gmail.com",
                "EmailReceipt": true,
                "BillingAddress": "76, Sch. 115",
                "BillingCity": "Indore",
                "BillingState": "MP",
                "BillingCountry": "India",
                "BillingZipCode": "452011",
                "ShippingFirstName": "Ayush",
                "ShippingLastName": "Rane",
                "ShippingAddress": "76, Sch. 115",
                "ShippingCity": "Indore",
                "ShippingState": "MP",
                "ShippingCountry": "India",
                "ShippingZipCode": "452011",
                "ShippingMobileNo": "9987887733"
            },
            "ProductData": "{'PaymentReason':'OnlineOrder for OrderNo- 1234'}",
            "OrderPaymentCustomerData": {
                "FirstName": "Ayush",
                "LastName": null,
                "Address": null,
                "City": null,
                "State": null,
                "ZipCode": null,
                "Country": null,
                "MobileNo": "7887673322",
                "Email": "ayushtesting12@gmail.com",
                "UserId": null,
                "IpAddress": null
            },
            "UpiLink": null,
            "OrderPaymentTransactionDetail": null,
            "UserDefinedData": {
                "UserDefined1": "",
                "UserDefined2": null,
                "UserDefined3": null,
                "UserDefined4": null,
                "UserDefined5": null,
                "UserDefined6": null,
                "UserDefined7": null,
                "UserDefined8": null,
                "UserDefined9": null,
                "UserDefined10": null,
                "UserDefined11": null,
                "UserDefined12": null,
                "UserDefined13": null,
                "UserDefined14": null,
                "UserDefined15": null,
                "UserDefined16": null,
                "UserDefined17": null,
                "UserDefined18": null,
                "UserDefined19": null,
                "UserDefined20": null
            },
            "SplitPaymentResponse": null,
            "Id": 93281
        }  
 

Step 2: Payment process url for checkout 🔗

This payment url is used to redirect to actual payment screen.

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

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

Step 3: Order Details (API request Parameters) 🔗

      
Authorization: basic authentication with base64encoded
PayGAuthentication –
<MerchantAuthenticationKey>:<MerchantAuthenticationToken>:M:<MID>
      
      

      
         {
            "OrderKeyId": "93281250227M10404UTEST512scx3",
            "MID":"3EMF9915EF35567",
            "PaymentType": ""
        }
      
      

      
def orderDetail(self,post_data):
        url = self.paymentURL+"/Detail"      
        message = self.AuthenticationKey+":"+self.AuthenticationToken+":M:"+self.MerchantKeyId
        message_bytes = message.encode('ascii')
        base64_bytes = base64.b64encode(message_bytes)
        base64_message = base64_bytes.decode('ascii')
        
        myfamily = {
            "OrderKeyId":post_data.get('OrderKeyId'),
            "MerchantKeyId":self.MerchantKeyId,
        }
        
        payload = json.JSONEncoder().encode(myfamily);
        headers = {
        'content-type':  "application/json",
        'authorization': "Basic "+base64_message,
        'cache-control': "no-cache",
        'postman-token': "d755d76a-eee0-437a-48f6-cd08297493f8"
        }

        response = requests.request("POST", url, data=payload, headers=headers)
        pprint.pprint("yagyang start")
        pprint.pprint(response.text)
        pprint.pprint("yagyang end")
        
         return json.loads(response.text)
    

    
      
      

      
         {
            "OrderKeyId": "93281250227M10404UTEST512scx3",
            "MerchantKeyId": 10121,
            "UniqueRequestId": "TEST512scx3",
            "OrderType": "PAYMENT",
            "OrderAmount": 3.00,
            "OrderId": null,
            "OrderStatus": "1",
            "OrderPaymentStatus": 0,
            "OrderPaymentStatusText": "Paid",
            "PaymentStatus": 0,
            "PaymentTransactionId": "767926",
            "PaymentResponseCode": 1,
            "PaymentApprovalCode": null,
            "PaymentReasonCode": null,
            "PaymentTransactionRefNo": null,
            "PaymentResponseText": "Approved",
            "PaymentMethod": "CreditCard",
            "PaymentAccount": "41111 - XXXX - 1111",
            "OrderRefundTransactionId": 0,
            "RefundPaymentResponseCode": 0,
            "RefundPaymentResponseText": null,
            "RefundDateTime": null,
            "CardType": null,
            "CardLevel": null,
            "OrderNotes": "Internal",
            "PaymentDateTime": "2/27/2025 1:57:09 PM",
            "UpdatedDateTime": "2/27/2025 1:52:35 PM",
            "PaymentProcessUrl": null,
            "CustomerData": {
                "CustomerId": "123456",
                "CustomerNotes": "Mens clothing",
                "FirstName": "Ayush",
                "LastName": "Rane",
                "MobileNo": "7887673322",
                "Email": "ayushtesting12@gmail.com",
                "EmailReceipt": false,
                "BillingAddress": "76, Sch. 115",
                "BillingCity": "Indore",
                "BillingState": "MP",
                "BillingCountry": "India",
                "BillingZipCode": "452011",
                "ShippingFirstName": "Ayush",
                "ShippingLastName": "Rane",
                "ShippingAddress": "76, Sch. 115",
                "ShippingCity": "Indore",
                "ShippingState": null,
                "ShippingCountry": "India",
                "ShippingZipCode": "452011",
                "ShippingMobileNo": "9987887733"
            },
            "ProductData": "{'PaymentReason':'OnlineOrder for OrderNo- 1234'}",
            "OrderPaymentCustomerData": null,
            "UpiLink": null,
            "OrderPaymentTransactionDetail": [
                {
                    "OrderKeyId": "93281250227M10404UTEST512scx3",
                    "MerchantKeyId": 10404,
                    "TransactionId": 767926,
                    "ResponseCode": 1,
                    "ResponseText": "Approved",
                    "TransactionAmount": 3.00
                }
            ],
            "UserDefinedData": {
                "UserDefined1": "",
                "UserDefined2": null,
                "UserDefined3": null,
                "UserDefined4": null,
                "UserDefined5": null,
                "UserDefined6": null,
                "UserDefined7": null,
                "UserDefined8": null,
                "UserDefined9": null,
                "UserDefined10": null,
                "UserDefined11": null,
                "UserDefined12": null,
                "UserDefined13": null,
                "UserDefined14": null,
                "UserDefined15": null,
                "UserDefined16": null,
                "UserDefined17": null,
                "UserDefined18": null,
                "UserDefined19": null,
                "UserDefined20": null
            },
            "SplitPaymentResponse": null,
            "Id": 93281
        }
      
      

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