#sébastien

1 messages · Page 1 of 1 (latest)

dim meteorBOT
warped badge
#

Hi there, so you want to set up two webhook endpoints for two Stripe accounts respectively ?

cerulean adder
#

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

warped badge
#

Got it. I don't see a need to set up two webhook endpoint if you have only one Stripe account.

cerulean adder
#

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

warped badge
#

Even if you set up two webhook endpoints, the same events will be sent to both of them.

cerulean adder
#

Of course you are right, sorry.
Is there an alternative to receive a payment notification based on a product and not on the webhook?

warped badge
cerulean adder
#

A product created on Stripe is associated with a website

#

Two products for two website

warped badge
#

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?

cerulean adder
#

Yes and receive a payment notification on a specific url, different depending on the product

warped badge
#

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.

cerulean adder
#

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?

warped badge
#

Can you check if the test mode toggle is on?

#

It's at the right upper corner.

cerulean adder
#

I saw that, sorry. It's OK. But I don't find Line_items on my checkout.session.completed log...

warped badge
#

It's not included by default, and you need to call the retrieve API and set expand=["line_items"]

cerulean adder
#

Nice. Thank you and good day