Step 1: Create New Order (REST API) 🔗

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

         
router.post('/create_order_post', function(req, res, next) {
   
   var form_post=JSON.parse(JSON.stringify(req.body));

   

   let headerurl = `${config.AuthenticationKey}:${config.AuthenticationToken}:M:${config.MerchantKeyId}`;
   let encode_header_credentail = encode.encode(headerurl, 'base64');
   
   var options = {
      method: 'POST',
      url: config.paymentURL+'/create',
      headers: 
      {
         'postman-token': '6b698fc7-a018-1a8c-bdc5-c2852851152f',
         'cache-control': 'no-cache',
         'content-type': 'application/json',
         authorization: 'Basic '+encode_header_credentail 
      },
      body: 
      { 
         Merchantkeyid: config.MerchantKeyId,
         UniqueRequestId: shortid.generate(),
         OrderStatus: 'Initiating',
         UserDefinedData: { UserDefined1: '' },
         RequestDateTime: '02/09/2021',
         RedirectUrl: config.RedirectUrl,
         TransactionData: 
         { 
            AcceptedPaymentTypes: '',
            PaymentType: '',
            SurchargeType: '',
            SurchargeValue: '',
            RefTransactionId: '',
            IndustrySpecificationCode: '',
            PartialPaymentOption: '' 
         },
         OrderAmount: form_post.OrderAmount,
         OrderType: 'MOBILE',
         OrderAmountData: { 
            AmountTypeDesc: form_post.AmountTypeDesc, Amount: form_post.Amount 
         },
         CustomerData: 
         { 
            CustomerId: form_post.CustomerId,
            CustomerNotes: form_post.CustomerNotes,
            FirstName: form_post.FirstName,
            LastName: form_post.LastName,
            MobileNo: form_post.MobileNo,
            Email: form_post.Email,
            EmailReceipt: form_post.EmailReceipt,
            BillingAddress: form_post.BillingAddress,
            BillingCity: form_post.BillingCity,
            BillingState: form_post.BillingState,
            BillingCountry: form_post.BillingCountry,
            BillingZipCode: form_post.BillingZipCode,
            ShippingFirstName: form_post.ShippingFirstName,
            ShippingLastName: form_post.ShippingLastName,
            ShippingAddress: form_post.ShippingAddress,
            ShippingCity: form_post.ShippingCity,
            ShippingState: form_post.ShippingState,
            ShippingCountry: form_post.ShippingCountry,
            ShippingZipCode: form_post.ShippingZipCode,
            ShippingMobileNo: form_post.ShippingMobileNo ,
         },
         IntegrationData: 
         { 
            UserName: form_post.UserName,
            Source: 'MobileSDK',
            IntegrationType: '11',
            HashData: form_post.HashData,
            PlatformId: form_post.PlatformId 
         } 
      },
      json: true 
   };
   request(options, function (error, response, body) {
     if (error) throw new Error(error);
     
   //res.render('thanks', {title:"Thanks", OrderKeyId: body.OrderKeyId,PaymentProcessUrl:body.PaymentProcessUrl });

   open(body.PaymentProcessUrl, function (err) {
      if ( err ) throw err;    
   });

   
   });
});


      

   {"OrderKeyId":"210619M11172U6f463b05b1",
"MerchantKeyId":11172,
"UniqueRequestId":"6f463b05b1",
"OrderType":"PAYMENT",
"OrderAmount":45,
"OrderId":77,
"OrderStatus":'',
"OrderPaymentStatus":0,
"OrderPaymentStatusText":'',
"PaymentStatus":0,
"PaymentTransactionId":'',
"PaymentResponseCode":0,
"PaymentApprovalCode":'',
"PaymentTransactionRefNo":'',
"PaymentResponseText":'',
"PaymentMethod":'',
"PaymentAccount":'',
"OrderNotes":'',
"PaymentDateTime":'',
"UpdatedDateTime":'',
"PaymentProcessUrl":"https:\/\/payg.in\/payment\/payment?orderid=210619M11172U6f463b05b1",
"OrderPaymentCustomerData":{
   "FirstName":"kanhaiya",
   "LastName":'dhaked',
   "Address":'jaipur',
   "City":'jaipur',
   "State":'RJ',
   "ZipCode":'302020',
   "Country":'IN',
   "MobileNo":"8619083450",
   "Email":"kl.nagar7@gmail.com",
   "UserId":'34',
   "IpAddress":'127.0.0.1'
   },
"UpiLink":"upi:\/\/pay?pa=A2zfame@yesbank&pn=A2zfame&mc=8999&am=0&mam=null&cu=INR&mode=01&orgid=00000&mid=YES0000001558758&sign=YzYxYzhmOWI5MjY1MjM3ZDEzMzQ0NDhkYWQ3NTNlZGE5OTcwMDE2MjEyODQ2ZDFiZjdlNTU4YmM3OThkOTY0NGIxYzk3OGIxNGZjM2VkMWRhYjA2MDA4MDhhZDY2M2Q2Y2I5MWQ4ZmExMTAzMjU0YzJhNTk4MDRjMzhlZmVkNGI="
}
  
 

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:<MerchantKeyId>
      
      

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

      
router.all('/order_detail',function(req, res, next){
   let headerurl = `${config.AuthenticationKey}:${config.AuthenticationToken}:M:${config.MerchantKeyId}`;
   let encode_header_credentail = encode.encode(headerurl, 'base64');

   var form_post=JSON.parse(JSON.stringify(req.body));

   console.log(form_post.OrderID)
   console.log(">>>>>>>>>>>>>>");
   var options = { method: 'POST',
      url: config.paymentURL+'/Detail',
      headers: 
      { 'postman-token': 'd0b751f6-ffce-e5e0-e7a5-56d0129fbe88',
         'cache-control': 'no-cache',
         'content-type': 'application/json',
         authorization: 'Basic '+encode_header_credentail },
      body: 
      { OrderKeyId: '210315M7963U7QXjJakL45',
         MerchantKeyId: '7963',
         PaymentType: '' },
      json: true };

      request(options, function (error, response, body) {
         if (error) throw new Error(error);
         
         res.render('order_detail', { title: 'Order detail333',body: body});
      });
});
      
      

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