#Duplicated

1 messages ยท Page 1 of 1 (latest)

lavish jasperBOT
gritty prairie
#

If the event is a live-mode event, it'll be livemode = true

#

can you share the sample live mode event that doesn't have livemode = true?

eager cloud
#

I've blocked out some potentially identifiable information here, but I can DM you the actual event ID.

fickle jewel
#

Hi! I'm taking over this thread.

#

Can you share the event ID (evt_xxx)?

eager cloud
#

@fickle jewel evt_3Ll4iQJjv9PMR4aC0Hr8S7NA

fickle jewel
#

Thanks! In this event I see livemode: false. This is not what you were expecting?

#

Oh, your question if why you are getting test mode events to your live mode webhook endpoint?

eager cloud
fickle jewel
eager cloud
#

That lines up with what the documentation says then.

In that case, if I would like the test payload to only go into the webhook endpoint inside test mode, what do I need to do?

#

Also, I'm not sure if this matters or not, but whoever set up Stripe webhook endpoints for this particular account reused the same endpoint for both live and test mode.

From the previous ticket:

I also have the same webhook endpoint for my backend registered on Stripe in both modes under the same Stripe parent account, so it looks something like this:

live mode: <domain_A><route_A><query_parameter_A>
test mode: <domain_A><route_A><query_parameter_A>&<query_parameter_B>

fickle jewel
#

In that case, if I would like the test payload to only go into the webhook endpoint inside test mode, what do I need to do?
That makes sense, unfortunately that's not possible when using Connect. So you'll need to write some code to ignore test events in your livemode webhook by checking the livemode property of the event.

#

Also, I'm not sure if this matters or not, but whoever set up Stripe webhook endpoints for this particular account reused the same endpoint for both live and test mode.
Interesting. Well that means that both live mode and test mode event will definitely go to the same URL then.

eager cloud
fickle jewel
#

That's completely up to you. You could use a single URL as long as your code process livemode and test mode events differently.

true lantern
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

eager cloud
#

You could use a single URL as long as your code process livemode and test mode events differently.
That's what I did earlier, but the fact that it has livemode: false when inside both live and test mode webhook endpoints means I cannot differentiate one payload from the other.

Basically, what I was trying to do is to process only one of these webhooks. In this case, since they're essentially the same event, with the exact same payload, either one is fine, but because I have no way of remembering whether I have already processed this particular event id yet or not (without extensively modifying my business logic), they both pop up within the backend service.

true lantern
eager cloud
#

Like I said at the beginning of this conversation, I cannot differentiate using the field livemode since it's a payload created in test mode, which goes into both live and test mode webhook endpoints (exactly as explained in the doc you and your colleague have shared with me), where both live and test mode webhook endpoints happen to be the same one.

#

Anyhow, I've already updated the business logic to check for my custom flag instead, which is independent of Stripe, so hopefully that should be the last of this issue (for now). Thank you all ๐Ÿ‘

true lantern
#

Glad to hear, that you've managed to find a solution. Don't hesitate to come back if you have any follow-up Questions ๐Ÿ™‚

obsidian timber
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!