I'm trying to integrate Paypal functionality into my site. I have installed the SDK and I'm able to 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'm able to create invoices properly, they show up under my sandbox notifications. I've also setup a sandbox webhook in my REST API app on Paypal, with a url provided. However, when I try to use the webhook simulator to generate an event (Invoice Paid), it doesn't seem that the function I've assigned to handle the post request is triggering.
So to review my issue...
A sandbox webhook is setup on Paypal for url https://www.example.com/webhook_test.
In my routes file, I have the following code to handle post requests.
Route::post('/webhook_test', 'WebhookController@InvoicePaid');
The InvoicePaid function is simply updating a table.
I try to use the webhook simulator on Paypal to simulate an "Invoice Paid" event to the url I've identified above, but when I check my table, nothing seems to have been updated.
Is there a step I'm missing in the overall setup? Any help would be appreciated!
I found the answer after digging around, in case anyone else runs into the same problem.
There's a class VerifyCsrfToken that had to be updated. Since paypal webhook post requests don't send a csrf token, then we need to add our webhook page to the exception list in this class.
ie: protected $except = [ 'invoiceWebhook' ];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With