0

Hi I am working on laravel project and integrated payment method, there is requirement of payment method to pass redirectURL which is based on POST method, however passing normal route it through error of 419. So is there any way to attach csrf token with route method or pass intended route in an array. There is screenshot of my code.

Code Screenshot

1 Answers1

1

You can exclude the csrf token check in your application for that redirect URL by adding the URI path to VerifyCsrfToken class inside App\Http\Middleware\VerifyCsrfToken Middleware .

See the example below Where /payment/callback is the redirect URI

<?php

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

class VerifyCsrfToken extends Middleware
{
  /**
    * The URIs that should be excluded from CSRF verification.
    *
    * @var array
  */
   protected $except = [
    '/payment/callback'
    ];
}

Passing the csrf token might not solve your problem except the payment partner agrees to include the token in the redirected request payload.

Samuel Olufemi
  • 715
  • 2
  • 12