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"
},
}
public void CreateOrderRequest()
{
string apiurl = "https://uatapi.payg.in/payment/api/Order/Create";//uat url
string AuthenticationKey = txtAuthenticationKey.Text;
string AuthenticationToken = txtAuthenticationToken.Text;
string Mid = txtMerchantkeyid.Text;
string stringForBase64 = StringForBase64(AuthenticationKey, AuthenticationToken, Mid);
string authorizationHeader = Base64Encode(stringForBase64);
var orderRequest = new OrderRequest();
orderRequest.MerchantKeyId = Convert.ToInt32(txtMerchantkeyid.Text);
orderRequest.UniqueRequestId = Guid.NewGuid().ToString().Substring(0, 10);
orderRequest.OrderAmount = Convert.ToDecimal(txtAmount.Text);
//orderRequest.RedirectUrl = "https://localhost:44341/OrderResponse.aspx?Orderid="+orderRequest.UniqueRequestId;
orderRequest.ProductData = "{'PaymentReason':'reason for this payment', 'AppName':'yourAppName'}";
string inputJson = (new JavaScriptSerializer()).Serialize(orderRequest);
WebClient client = new WebClient();
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
client.Headers["Content-type"] = "application/json";
client.Encoding = Encoding.UTF8;
client.Headers[HttpRequestHeader.Authorization] = "basic " + authorizationHeader;
string json = client.UploadString(apiurl, inputJson);
OrderResponse orderResponse = (new JavaScriptSerializer()).Deserialize
(json);
Session["OrderKeyid"] = orderResponse.OrderKeyId;
Session["Merchantkeyid"] = orderResponse.MerchantKeyId;
Session["AuthenticationKey"] = txtAuthenticationKey.Text;
Session["AuthenticationToken"] = txtAuthenticationToken.Text;
// TempData["OrderKeyid"] = orderResponse.OrderKeyId;
System.Diagnostics.Process.Start(orderResponse.PaymentProcessUrl);
}
{"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="
}