#prathyusha_code
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1398302498829238292
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
what do you mean by environment, exactly?
You can have products/prices using different currencies in a single account, sure
All events of a given type will be delivered to all endpoints set up for that type
I have my project in two 2 different regions, one is canada, one is US
If you want to apply currency-related filterz on those endpoints to split the processing, you can certainly do that
Using single stripe account for both environments
If its the same business thats fine
If you have different entities in the two countries, you should consider splitting that into a separate account
All events of a given type will be delivered to all endpoints set up for that type
What does it mean ?
I mean stripe endpoint delivery doesnt know if your payments are from canada or in cad vs usa/usd to "pre-sort" these for you
I inferred you were asking about setting up a "usd endpoint" and a "cad endpoint" which isnt possible
You can set up both, but what i mean is that both endpoint would get all the payment events (or whatever event types you set up for each endpoint).
Let's take a step back: what are you trying to do with endpoints/webhooks?
track invoice.payments, subscriptions, payment failures, credit grants handing
Sure, thats fine, you can get al those events. Is some part of this not working as you expect?
const currency = getCurrencyFromEvent(event);
const environment = currency === 'cad' ? 'production'
: currency === 'usd' ? 'staging'
: 'unknown';
based on this I want to divert requests into different environment in my code, once a webhook event triggers i need some kind of info , like this customer is subscribed to this environment
Hi, taking over as my teammate needs to step away. Let me catch up.
Fully caugh up now. There is not a filter logic like that to send event to different endpoints like you imagined no. You will need to perform them logic on your end after you recieve the events on the same webhook endpoint.
will every event type have customer information
but based on what information i can differentiate in my code
charge.succeeded
customer.created
customer.deleted
customer.updated
customer.subscription.created
customer.subscription.updated
invoice.created
invoice.deleted
invoice.finalization_failed
invoice.finalized
invoice.marked_uncollectible
invoice.overdue
invoice.paid
invoice.payment_action_required
invoice.payment_failed
invoice.payment_succeeded
invoice.sent
invoice.upcoming
invoice.updated
invoice.voided
invoice.will_be_due
payment_intent.amount_capturable_updated
payment_intent.canceled
payment_intent.created
payment_intent.partially_funded
payment_intent.payment_failed
payment_intent.processing
payment_intent.requires_action
payment_intent.succeeded
setup_intent.canceled
setup_intent.created
setup_intent.requires_action
setup_intent.setup_failed
setup_intent.succeeded
I m using these events
That depends on what information you passed, sure. You can also pass metadata, https://docs.stripe.com/metadata and map that on your end.
As for the second question from above, you can receive the event and then look at the currency like you said
That logic will come from your end, after you recieve the event you can add any logic on your end
Let me check and get back, can we keep it open until i come bacj
Sure.
'payment_intent.succeeded',"payment_intent.created",'invoice.created','invoice.updated','customer.updated','setup_intent.created','invoice.payment_succeeded','invoice.paid','invoice.finalized','billing.credit_grant.created','billing.credit_grant.updated','billing.credit_balance_transaction.created','invoice.payment_failed','payment_intent.payment_failed','setup_intent.succeeded','customer.subscription.created','customer.subscription.deleted'
i am using these events if I get customer id in these all events, and if i set metadata for customer, when event is received i can retrieve customer metadata based on it i can make right request to respective environment
Yes, that would work: https://docs.stripe.com/api/customers/search?api-version=2024-09-30.acacia
im not seeing customer_id in billing.* event types
how can i get meta data for these
billing.credit_balance_transaction.created i must need to differentiate this
Can you share the specific event id with me please?
billing.credit_balance_transaction.created
this event
Can you share the event id that starts with evt_ please?
evt_1RndETGEuTpYR4fbPDZCB7JV
You willl need to make another GET call to retrieve the invoice, in_1RnFRfGEuTpYR4fbXuK0KMfk in this case.