Expand livemode event attribute for sandboxes

When there was only live and test mode the livemode event attribute was enough to know where the event came from. Now with sandboxes I would request additional event attributes that indicate which sandbox the event came from.

For various reasons it would be ideal if both the sandbox name and ID were in the event, but I could work with either

(Reposting as I couldn’t figure out how to change the category of my original post from General to Sandboxes)

Hi George!

This is great feedback to improve the event attributes. Could you tell you more about what your testing set up/motivation so I can better understand why you need to know which sandbox the event is from? Are you sending events across multiple sandboxes to the same endpoint?

In meantime, you can also add the sandbox ID/name in your webhook URL to get that data in your webhook handler.

for example, you could do something like this and then grab the query param in your handler.

https://example.com?sandbox={SANDBOX_ID}

Yes, we are sending events from multiple sandboxes into the same webhook.

The exact scenario is that we have set up some test users in our production environment that use Stripe Test mode so that we can experiment and see what is going on in production without actually charging ourselves. For the events produced we use the livemode attribute to determine which event listener secret to use to validate the stripe signature.

Now we want to setup this dual environment for our staging environment using 2 different sandboxes, however in this case livemode is false in both cases so we cannot differentiate using that, which is why I requested another attribute that indicates the source. Ideally this would apply to Test mode and live events as well.

In the meantime I will try the query parameter in the webhook URL. However I do believe that it being in the event payload itself is the better long term solution.