How to make an HTTP POST web request using C# - RestSharp
We have implemented the Airpay Payment Gateway Step-3 Webhook API Method to verify the payment.
var client = new RestClient("https://payments.airpay.co.in/order/verify.php");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
request.AlwaysMultipartFormData = true;
request.AddParameter("mercid", "mercid");
request.AddParameter("merchant_txnId", "merchant_txnId");
request.AddParameter("privatekey", "privatekey");
IRestResponse response =
client.Execute(request);
//XML Response in Variable
var XMLResponse = XElement.Parse(response.Content);
// Parse the response
// Node Store in Variable
var TransactionStatus =
XMLResponse.Descendants().First(node => node.Name == "TRANSACTIONSTATUS").Value;
var TransactionID =
XMLResponse.Descendants().First(node => node.Name == "TRANSACTIONID").Value;
var Amount =
XMLResponse.Descendants().First(node => node.Name == "AMOUNT").Value;
var
TransactionPaymentStatus = XMLResponse.Descendants().First(node => node.Name
== "TRANSACTIONPAYMENTSTATUS").Value;
You can contact me for understanding of Payment Gateway Integrations.
2 Comments
I found very helpful
ReplyDeleteI found very usefull
ReplyDeleteThanks for Commenting on our blogs, we will revert back with answer of your query.
EmojiThanks & Regards
Sonu Yadav