0

I'm trying to set up Adyen notifications in my webshop.
https://docs.adyen.com/development-resources/notifications/understand-notifications

When I test the HTTP post with Adyen test page I get a 301 response, but when I test the HTTP post with a custom form the route works.

Route in web.php:
Route::name('shop.checkout.adyen-notification')->post('/adyen-notification', 'Shop\CheckoutController@adyenNotification');

Settings in VerifyCsrfToken.php:
protected $except = ['*/adyen-notification?*'];

Custom form:

<form method="post" action="https://example.com/adyen-notification?originalReference=&reason=&merchantAccountCode=Test&eventCode=NOTIFICATIONTEST&operations=&success=true&paymentMethod=bankTransfer_BE&currency=EUR&pspReference=test_NOTIFICATIONTEST_1&merchantReference=testMerchantRef1&value=11099">
    <input type="submit" value="SUBMIT">
</form>

I can't figure out why it is giving me a 301 response.

  • 301 means "moved permanently". Since you white-listed the CSRF token and we don't see what your controller do, we have no idea what response you should get. What response do you expect? – LobsterBaz Mar 11 '20 at 15:43
  • @LobsterBaz My controller just returns a string atm moment for testing. When I submit the form I mentioned it returns the string just fine, but when I send a HTTP post from Adyen test page I get the 301 response. – Maykel Boes Mar 12 '20 at 08:44
  • 301 is the status, is there data in the response? Since it's a redirect status, where does it redirect to? I'm not familiar with Adyen but could it have anything to do with your local environment not using https? – LobsterBaz Mar 12 '20 at 18:01
  • @LobsterBaz It is returning the default 301 html from Laravel and is says it moved to the same url as I'm calling. My development environment uses https. – Maykel Boes Mar 13 '20 at 07:10
  • I never used Adyen but do you need to be in test mode with a test API key? Can your development server be reached from the Internet? Is your Laravel .env APP_URL matching your server URL? – LobsterBaz Mar 13 '20 at 21:55

1 Answers1

0

You have a typo in your form action, the closing quotation mark is missing:

<form method="post" action="https://example.com/adyen-notification?originalReference=&reason=&merchantAccountCode=Test&eventCode=NOTIFICATIONTEST&operations=&success=true&paymentMethod=bankTransfer_BE&currency=EUR&pspReference=test_NOTIFICATIONTEST_1&merchantReference=testMerchantRef1&value=11099>
    <input type="submit" value="SUBMIT">
</form>

Should be:

<form method="post" action="https://example.com/adyen-notification?originalReference=&reason=&merchantAccountCode=Test&eventCode=NOTIFICATIONTEST&operations=&success=true&paymentMethod=bankTransfer_BE&currency=EUR&pspReference=test_NOTIFICATIONTEST_1&merchantReference=testMerchantRef1&value=11099">
    <input type="submit" value="SUBMIT">
</form>

LobsterBaz
  • 1,752
  • 11
  • 20
  • I pasted it wrong here but it is oke. My custom form works so thats not the problem. Only when I post from Adyen I get the 301 response. – Maykel Boes Mar 12 '20 at 07:30