Answer the question
In order to leave comments, you need to log in
Robokassa and Laravel how to transfer a token?
Good afternoon,
we set the task to implement the work of Laravel 5.0.1 with the robokassa service.
But there was a problem when validating a successful payment, namely, that in response to POST data in Laravel, you need to
send csrf_token
.
Share your advice.
Answer the question
In order to leave comments, you need to log in
You don’t need to force Robokassa to transfer csrf_token
, you need to add the addresses where Robokassa knocks to the exceptions of the VerifyCsrfToken intermediary (but in 5.0 there is no such possibility out of the box, so look at how it was done in 5.1 and do the same).
Well, use https://github.com/idma/robokassa
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'payment'
];
}
You can remove the csrf_token check if it is not needed. (Disable middleware in Http\Kernel.php)
You can write your own class to check csrf_token and instead of `_token` take data from a custom field (`shp_*`)
Use omnipay, no crutches needed.
https://github.com/ignited/laravel-omnipay
https://github.com/hiqdev/omnipay-robokassa
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question