Atm i am making a payment system with mollie. First step of the payment goes smootly getting past the payment but when i ask for direct feedback by sending it threw the webhookurl(what is a post route) it gives back MethodNotAllowedHttpException error. I know that people have said to remove the csrf on the route by going into verifycsrftoken.php but that hasent done mutch to change my problem
Atm i have tried to compleetly copy the version stated on there website to no luck. further i have tried there php version that also dident get me any further. looked up to see that in app/http/kernal.php i need to remove the Illuminate\Foundation\Http\Middleware\VerifyCsrfToken but that one is not in there.
public function index()
{
$payment = Mollie::api()->payments()->create([
'amount' => [
'currency' => 'EUR',
'value' => '10.00', // You must send the correct number of decimals, thus we enforce the use of strings
],
'description' => 'My first API payment',
'webhookUrl' => route('webhooks.mollie'),
"redirectUrl" => "https://Standardpage.com/payment",
]);
$payment = Mollie::api()->payments()->get($payment->id);
// redirect customer to Mollie checkout page
return redirect($payment->getCheckoutUrl(), 303);
}
the code above is the part what sends you to the ideal payment via there api this part works most of the time with out any errors
public function handle(Request $request) {
if (! $request->has('id')) {
return;
}
$payment = Mollie::api()->payments()->get($request->id);
if($payment->isPaid()) {
// do your thing...
}
}
the code above is when you return from the payment but it normaly doesent reach this far becuse it gives the error MethodNotAllowedHttpException becuse of the post route
Route::name('webhooks.mollie')->post('payment', 'Payments\MolliePaymentController@handle');
this code above me is my web.php file.
this is the route that mollie uses in there previews and github pages. It uses a post method what breaks the function and gives back that error. and if you make the post into a get it will just give back a empty $request array
for my error that i get back this is the error i see when comming back form the payment page. Error given back by the post route
what i am expected to get back is the id of the payment so i can get the payment back and save the payment into a database.
As a actual results i have manged to do it a diferent way but it isent stated on there website or anywhere els and that is to save the original $payment in a $_SESSION and use it again in the handle function that will show the payment and it will give back that it has bin paid.
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2H1GPoi
via IFTTT
Aucun commentaire:
Enregistrer un commentaire