0
votes

I got a webshop (Laravel API/Vue) that uses Stripe. I have 3 environments for this app, local, development/staging and production.

Local and development/staging use the same Stripe publishable and secret test key, but use different webhook secret test keys.

My local environment is using Laravel Homestead and I use ngrok installed on my pc (windows) to forward my local environment to a live server.

I recently noticed that whenever I test a transaction on my local server, which triggers a payment_intent.succeeded event on Stripe, this event gets handled in a job on both local AND development/staging. This results in an order being processed and saved on the development database, even if that order is placed using the local environment. It's vice versa whenever I test a transaction on the development environment.

On the Stripe dashboard I use 2 webhook endpoints, one for local (which is the ngrok live server) and one for the development/staging environment.

I have no explanation for it. Any pointers would be awesome to resolve this strange issue.

1

1 Answers

1
votes

If both your local and development/stating endpoints are listening for the same events, then this is expected as the events are generated on the account level, not the individual endpoint level.

For instance, if both your endpoints are listening to the payment_intent.succeeded event, then both your endpoints will receive that event if a payment succeeds.

To be absolutely sure that you don't get the events sent to both environments, you should look at using a separate Stripe account for testing your local environment.