stripe / stripe-apps

Stripe Apps lets you embed custom user experiences directly in the Stripe Dashboard and orchestrate the Stripe API.
https://stripe.com/docs/stripe-apps
MIT License
148 stars 73 forks source link

Improvements to local development flow for webhooks #988

Open dan-massey opened 1 month ago

dan-massey commented 1 month ago

Is your feature request related to a problem? Please describe. As far as I can figure out, it isn't possible to develop and test webhook endpoints locally which need to receive connected account events.

For example, if I have a Stripe App that has a backend hosted elsewhere, to develop views locally I can run stripe apps start --manifest stripe-app.dev.json. Requests can be sent to a server running on localhost and it's easy to do iterative development because both my server and the Stripe App hot reload as I'm working.

For my webhook endpoint, running on localhost, I can send events using the Stripe CLI, but these are not Connect Webhooks but they are missing the account field that would be present in a deployed app.

So, instead, to test my webhook endpoint the steps I have to follow are:

Then for every iteration I need to redeploy my backend and re-upload the Stripe App, generate a new installation link, reinstall the app, etc.

Describe the solution you'd like

Describe alternatives you've considered

benhodes-stripe commented 1 month ago

Makes sense and is very much less than ideal. Are there any other settings beyond webhooks that you're looking to test between versions?

dan-massey commented 1 month ago

Thanks for taking a look @benhodes-stripe

One other possible improvement to the webhook flow:

The only other related challenge is then testing frontend development, when the frontend is displaying values that have been generated by my backend in response to the webhooks. Because these events are related to the test account where I have run my external test, I can't run stripe apps start in that account as I'm making changes. So that also means that for each iteration I need to upload a new version and set it as being used for the external test (rather than hot reloading).