Paddle webhook handler doesnt work
InfinityXTech opened this issue · comments
Cashier Paddle Version
2.3
Laravel Version
10.43.0
PHP Version
8.2.15
Database Driver & Version
No response
Description
First I commented verify signature middleware because it was failing there as well. And logged:
logger('PADDLE DATA:', [$payload, $request->header()]);
To get this:
[
{
"alert_id": "8941471",
"alert_name": "invoice_sent_v2",
"amount": null,
"country": "RS",
"currency": "EUR",
"custom_data": "[]",
"customer_address": null,
"customer_city": null,
"customer_company_number": null,
"customer_id": "ctm_01hq4qaxw3sywf6vfdjbtz8mdz",
"customer_name": "Name",
"customer_state": null,
"customer_vat_number": null,
"customer_zipcode": null,
"date_issued": "2024-02-21 03:34:39.009668001 +0000 UTC",
"days_until_overdue": "1",
"email": "email@email.com",
"event_time": "2024-02-21 03:34:39",
"gross_amount": "4000",
"invoice_id": "a57ade10-9a49-4ab4-aea9-2a3075ff589c",
"invoice_number": "6152-10003",
"issued_items": "[{\"product_name\":\"Enterprise\",\"product_description\":\"\",\"tax_rate\":0,\"product_tax_value\":0,\"paddle_entity_tax_value\":0,\"price\":4000,\"quantity\":1}]",
"net_amount": "4000",
"purchase_order_number": null,
"status": "pending_acceptance",
"tax_amount": "0",
"p_signature": "lXggJhQ0oKnd+5cyCzi4gONRvdaWuqUK6JYMFnuFfqcxNehTeIa1Wj+61ga3XHKIIM09coxrpLOEJGwx+ITBsKVUoTaTJFlvKT20DqUWhRDefRYtQ5NI9uObCp4rEDTnNgyVTM56keHpkKIkEwoAlRseO9A2zj/a/UFtUFUeaklU40XzBSzW03v4ik2t0FhjIHD4huNx6cII7EhDh7h00FOp6t07p1JhepNajXRMAXgP4F1R1z5BhUFi1M7vXkMaIHG6OOt161j6rUbCxo6Uzd3oOfRr/PvVLYeM1sEQ3S4TMFxT5ONwd1ia/+kvtMARYE5ojshTPAA/i5jnrl0d43TJnzJcwmU/+LwKajAlnRnG4DW8IOysEkQRQzIWZOLdR6qWg9XuL5JyYZIlPPXICrYxoEUr71ozJ7SlwkiLSd3Iv7o6hHts7ChFgKhDwREOyNl1U9x9y68WNrlYe3fHxC1MeBFF2m2Yh9Rgo1aZTN12+bhIWu+HsX5bDSxB1RJUM0QLCGU4q+lpk4Mwj/u/uY3pTfsHuqdQe6RGsMJ3VKTAeHy4id+tyeGTAraaTTgoinBpnhH92zumEIGvpseKdcxKrMcjD7fXh9VYlLaSX9p+g1JZMSTT3BSVK6k9Iizkee7pcfbaaKfrzi4CR0W3LCKD99C00zQQYL4g9QdvSv8="
},
{
"content-type": [
"application/x-www-form-urlencoded"
],
"content-length": [
"1555"
],
"traceparent": [
"00-0000000000000000707ea119a38ca93b-2231d7c3785e5c62-01"
],
"newrelic": [
"eyJ2IjpbMCwxXSwiZCI6eyJ0eSI6IkFwcCIsImFjIjoiMTcwOTY0MSIsImFwIjoiMTc5MTkxOTc5MSIsImlkIjoiMjIzMWQ3YzM3ODVlNWM2MiIsInRyIjoiNzA3ZWExMTlhMzhjYTkzYiIsInR4IjoiNzA3ZWExMTlhMzhjYTkzYiIsInByIjoxLjg5Njk5LCJzYSI6dHJ1ZSwidGkiOjE3MDg0ODY0Nzk4MjF9fQ=="
],
"tracestate": [
"1709641@nr=0-0-1709641-1791919791-2231d7c3785e5c62-707ea119a38ca93b-1-1.896992-1708486479821"
],
"accept": [
"*/*"
],
"user-agent": [
"Paddle"
],
"host": [
"avjqmy1hloa5ldcs9056.cleavr.one"
]
}
]
And this error in log:
local.ERROR: Undefined array key "event_type" {"exception":"[object] (ErrorException(code: 0): Undefined array key \"event_type\" at /vendor/laravel/cashier-paddle/src/Http/Controllers/WebhookController.php:48)
If I 'fix" that then I get Undefined array key \"data\"
and maybe more. So it seems that paddle changed their request ways, not sure do I need to update something here as use different version or?
Thanks
Steps To Reproduce
New Laravel app with this package and paddle billing version.
These are Paddle Classic events coming in. If you're using Paddle Classic you'll need to use Cashier Paddle v1.
@driesvints @soixt Do you guys know how can I subscribe to paddle billing events instead of paddle classic version? I am using this test url: https://sandbox-vendors.paddle.com/webhook-alert-test
When I call webhook. It does not include Paddle-Signature
header. Any suggestions?
@aditodkar you need to switch to paddle billing on the left bottom of your screen. You're currently in Paddle Classic mode.
I am also not able to get the paddle signature in my webhook .
"message": "Invalid webhook signature.",
"exception": "Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException",
"file": "/Users/sahilmaheshwari/Documents/GitHub/roadmap/vendor/laravel/cashier-paddle/src/Http/Middleware/VerifyWebhookSignature.php",
"line": 33,
"trace": [```
Afaik this all works. Are you all sure you're using the Paddle Billing screens?
Thanks for the reply @driesvints . Appreciate the same !!
Here's what I am getting currently even after setting up the webhook secret as the env. And updating the app/bootstrap page with the exclude paddle line.
Your config isn't cached I presume? Can you set the secret between quotes in your env and try again?
Just checked it , it is under quotations @driesvints . I did try to remove quotations and place it again but no changes.
I currently don't have time to double check this sorry. If you find a solution to your problem please send in a PR. Right now we don't have any sight on widespread problems around signature verification with Paddle webhooks.
Apologies. @driesvints , I was able to resolve my problem . So the thing was i stupidly forgot to change the webhook secret. I am using a ngrok tunnel for creating the user flow in the local.