Getting the property send by api in mvc

142 Views Asked by At

I am using paytab's API. (paytab is a payment gate way api). after payement it will return to my actionresult TheReturnPage(). There I need to get the payement_refrence property which the paytab send with the POST method. in asp.net two tier i did it like this and worked for me

 public partial class TheReturnPage : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        HttpContext c = HttpContext.Current;
        if (c.Request["payment_reference"] != null)
        {

            string paymentReference = c.Request["payment_reference"].ToString();
            if (VerifyPayment(paymentReference))
            {
                //Payment is verified and logging out from payment process
                if (LogoutPayment())
                {
                    TextBox1.Text = "Payment is verified and logged out successfuly";

How can I do the same in MVC? paytab manual you can find here. https://www.paytabs.com/PayTabs-API%20Documentation.pdf

1

There are 1 best solutions below

0
On

You can use the Request.Form object in your controller, this object contains the POST values of the request, like this:

string paymentReference = Request.Form.Get("payment_reference");