#prathyusha_code

1 messages ¡ Page 1 of 1 (latest)

young arrowBOT
#

👋 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.

hearty trellis
#

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

pine rampart
#

I have my project in two 2 different regions, one is canada, one is US

hearty trellis
#

If you want to apply currency-related filterz on those endpoints to split the processing, you can certainly do that

pine rampart
#

Using single stripe account for both environments

hearty trellis
#

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

pine rampart
#

All events of a given type will be delivered to all endpoints set up for that type
What does it mean ?

hearty trellis
#

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?

pine rampart
#

track invoice.payments, subscriptions, payment failures, credit grants handing

young arrowBOT
hearty trellis
#

Sure, thats fine, you can get al those events. Is some part of this not working as you expect?

pine rampart
#

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

sullen notch
#

Hi, taking over as my teammate needs to step away. Let me catch up.

pine rampart
#

sure, hope you are following the scenario

#

@sullen notch there?

sullen notch
#

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.

pine rampart
#

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

sullen notch
#

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

pine rampart
#

Let me check and get back, can we keep it open until i come bacj

sullen notch
#

Sure.

pine rampart
#

'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

sullen notch
pine rampart
#

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

sullen notch
#

Can you share the specific event id with me please?

pine rampart
#

billing.credit_balance_transaction.created

this event

sullen notch
#

Can you share the event id that starts with evt_ please?

pine rampart
#

evt_1RndETGEuTpYR4fbPDZCB7JV

sullen notch
#

You willl need to make another GET call to retrieve the invoice, in_1RnFRfGEuTpYR4fbXuK0KMfk in this case.