#barhoush_webhooks
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/1270002555308609598
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there ๐ just making sure I'm understanding correctly, you have three separate webhook endpoints on three separate domains that you need to send Events to?
If so, then you would add each of those as a webhook endpoint as you've described, and I'd be interested in looking at examples of Events that didn't go to all the endpoints you're expecting.
Three separate webhook endpoints for different domains. Keeping in mind that we need to distinguish the transactions.
Meaning, payments coming from domain1 should always go to domain1/path/to/webhook and payments coming from domain2 should always go to domain2/path/to/webhook and so on.
That's not possible if they're all going through the same Stripe account. All Events are sent to all webhook endpoints listening for that Event's type, you can't add filtering to that logic on the Stripe side. Instead you need to add that filtering logic on your side.
It sounds like you're talking about listening to Events emitted by your Connected Accounts, in which case you can use the account field on the Event to identify which Connected Account it belongs to:
https://docs.stripe.com/api/events/object#event_object-account
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So what would be the best practice to handle such case? At the end of the day, we are building a SaaS application that is expected to be deployed in separate servers so we'll have more apps and indeed, more webhook endpoints in the future.
It's hard to say without more context. Are you using a separate Connected Account on each domain, if so it sounds like the account field is a good identifier of where the Event came from. But let me know if there's context I don't have that causes that to not suit your needs.
If you need the Events from each Connected Account to go to a specific endpoint, then you will want to build a central endpoint that listens to all Events from your Connected Accounts and distributes them to the other endpoints as needed.
Are you saying that we must always have 1 endpoint for such case?
No, it doesn't have to be just one.
But I'm still not sure I'm grasping what you're trying to accomplish.
Okay, let's break it down:
I have an e-commerce app that is deployed into 3 customer servers, let's call em: customer-1.app, customer-2.app and customer-3.app. They all have seperate servers and infra.
All the 3 apps back-end have the same Stripe private and publishable keys, which means we are connecting the 3 apps with the same Stripe account, which is in fact our company account.
We agreed to charge each customer with a fee and that's why we are using Stripe Connect and send CONNECTED_ACCOUNT_ID and ofcourse fee_amount in the payment intent. In fact, we have already created 3 connected accounts and we have the ids that start with acct_1xxxx.
After that we defined the 3 webhook endpoints in our Stripe Dashboard, which are:
customer-1.app/webhook
customer-2.app/webhook
customer-3.app/webhook
Now the issue we are having is that it seems wherever a payment request is initiated, only the first webhook endpoint gets executed, for example if an end user buys from customer-2.app the webhook customer-1.app/webhook gets executed which is false, we need to map the exact webhook URL for every shop.
Are we doing the setup correctly? and what should be the best practice to do for such case?
All the 3 apps back-end have the same Stripe private and publishable keys, which means we are connecting the 3 apps with the same Stripe account, which is in fact our company account.
This sounds risky, it sounds like you're giving your Platform's secret key to third-parties, which I would not recommend doing.
I think that's where the disconnect is for me. If you're using Connect, then typically you as the Platform should be controlling the backend.
Yes we control the back-end
Sorry, I don't understand then, I thought you said you give the backend to your customers to run on their servers.
In fact the 3 apps are deployed in our cloud and we gurantee that no one will access our code base except us
Oh, gotcha
Then I'd recommend having one endpoint that has all Connect Events coming to it, and then send each of those to your endpoint for each Connected Account.
The only time that might not work, is if you can have one customer running multiple domains with the same Connected Account.