This may be code I tried.
I am trying to redirect the client to the payment gateway after payment is done it returns back by return URL.
But I did not figure out how:
[HttpPost]
public ActionResult PaymentGateway()
{
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://abc.gateway.mastercard.com/api/rest/version/6/merchant/xxx/order/1/transaction/1");
httpWebRequest.Credentials = CredentialCache.DefaultCredentials;
string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("xxxx:xxxx"));
httpWebRequest.Headers.Add("Authorization", "Basic " + credentials);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"apiOperation\":\"CAPTURE\"," +
"\"order.amount\":\"100.000\"}" +
"\"order.currency\":\"USD\"}" +
"\"browserPayment.redirectUrl\":\"https:\\example.com\callback\"}";
streamWriter.Write(json);
}
// how send request ?
return ??? ;
}