How do you handle a PayPal Webhook event in PHP using Laravel?

I am trying to integrate Paypal functionality into my website. I have installed the SDK and I can make calls to the Paypal API.

My main task is to create invoices and then update the database when the customer pays the invoice. I can correctly create invoices, they are displayed under my notifications in the sandbox. I also installed the webbox in the sandbox in my REST API application on Paypal with the url provided. However, when I try to use the webhook simulator to generate an event (Invoice Paid), it looks like the function that I assigned to process the send request starts.

So, to view my problem ...

Route :: post ('/ webhook_test', 'WebhookController @InvoicePaid');

  • The InvoicePaid function simply updates the table.

  • I am trying to use the Webhook simulator in Paypal to simulate the "Invoice Paid" event for the URL above, but when I check my table nothing is updated.

Is there any step that I am missing in the general setup? Any help would be appreciated!

+4
source share
1 answer

I found the answer after digging if someone else ran into the same problem.

VerifyCsrfToken. Paypal Webhook csrf, - .

..: protected $except = [       'InvoiceWebhook'   ];

0

Source: https://habr.com/ru/post/1661795/


All Articles