laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.37k stars 667 forks source link

Multiple Keys for Webhook Signing #1679

Closed l0gical closed 2 months ago

l0gical commented 2 months ago

Hi all,

Is it possible to have the webhook signature check 2x keys instead of one? I cannot seem to find the validation code in Cashier for this. (latest version with Laravel10) i.e STRIPE_WEBHOOK_SECRET STRIPE_WEBHOOK_SECRET2

This would be very handy when setting multiple webhooks with Stripe, for testing with the Cli it does precisely that (all webhooks to the same endpoint along with 1 key), typically on the live/staging, it's a pain as didn't expect to have to specify a webhook for regular and one for connected which is fine, BUT they each have a different key which cannot be manually set. My setup expands on the standard cashier for which I listen to events and process connected events separately.

Thx

l0gical commented 2 months ago

Think I have answered my own question, have done an override of VerifyWebhookSignature.php to allow multi key checking, will therefore mark this as closed.

driesvints commented 2 months ago

Just to answer your question: you usually only have one webhook for each environment. I have never found myself in a situation needing multiple ones. You can work with env variables between environments.

l0gical commented 2 months ago

Just to answer your question: you usually only have one webhook for each environment. I have never found myself in a situation needing multiple ones. You can work with env variables between environments.

Thanks, it was for using regular stripe and stripe connect (via event listener) to use the same webhook point, have successfully completed this with an override allowing the use of 2 different signing keys (regular and connect webhooks)

driesvints commented 2 months ago

Ah yeah, never used Stripe Connect with Cashier yet.