简体   繁体   中英

Sending request back from POST

I'm trying to implement a payment provider (AdYen) into my application. When a payment is done then AdYen will send me a notification by a HTTP POST request to an URL that i supplied in the backoffice. For example:

http://myhost.com/Payment/FinishPayment/

FinishPayment is an Action method in the Payment controller. The call does end up in that method, but AdYen gives me the following error:

The required string "[accepted]" is not in all the results

Somehow i have to return the string "[accepted]" in a "notificationResponse". But how?

I saw a PHP example which just this:

function FinishPayment( ) // function is called by AdYen
{
    // Do stuff...

    return array("notificationResponse" => "[accepted]");
}

Anyone any idea how i can send a response back in C#.NET MVC3 ??

This is rather old but as I'm currently working with it, maybe it could help anyone in the future

Choosing HTTP POST instead of SOAP will cause Adyen to make a POST for every notification, so in MVC 3 (or 4, or simply ASP .Net), you could create a generic handler to handle these requests, and just make a context.Response.Write("[accepted]"); . At least in the Test environment, it seems that they accept those responses as good.

By the way, they don't send any signature of the data as POST parameters, but they will authenticate with basic Http authentication through Authorization Header, if you configure an user and a password, in order to verify the request in your server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM