#sébastien
1 messages · Page 1 of 1 (latest)
Hi there, so you want to set up two webhook endpoints for two Stripe accounts respectively ?
Thanks. I have a single account with which I want to manage two websites, and therefore different products. I don't want to create a second Stripe account, I don't see the need
Got it. I don't see a need to set up two webhook endpoint if you have only one Stripe account.
The webhook allows me to manage my endpoint and therefore update my database and customer information. But my two products are on different servers. I would have liked to separate the two webhooks, with different urls, each associated with a product
Even if you set up two webhook endpoints, the same events will be sent to both of them.
Of course you are right, sorry.
Is there an alternative to receive a payment notification based on a product and not on the webhook?
Can I clarify the product that you are referring to, is it a website or the Stripe product (https://stripe.com/docs/api/products#products) ?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
A product created on Stripe is associated with a website
Two products for two website
OK, so you've created two products in Stripe, and you want to get notified when you customer completed the checkout and you want to know which product did they buy?
Yes and receive a payment notification on a specific url, different depending on the product
Got it. You can achieve this with just one webhook endpoint. Here's my suggestion.
Let your webhook endpoint listen to the checkout.session.completed event. This event will be fired when a customer has completed a checkout session.
Once the webhook endpoint receives the event, you should retrieve the checkout session and expand the line_items field. From there you can get the price ID of the product that your customer purchased.
OK, I'll try that, thanks. On the other hand, I validated my account this morning and I can no longer find all my tests (logs, payment, etc.). Can I put myself in the test phase again?
I saw that, sorry. It's OK. But I don't find Line_items on my checkout.session.completed log...
It's not included by default, and you need to call the retrieve API and set expand=["line_items"]
https://stripe.com/docs/api/expanding_objects#expanding_objects here's how you expand a response
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Nice. Thank you and good day