#livelove_best-practices

1 messages ¡ Page 1 of 1 (latest)

misty ridgeBOT
#

👋 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/1395844745875554387

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

silver grove
#

The other option would be to listen to a webhook event

sacred echo
silver grove
#

Stripe will notify you when the payment succeeds

sacred echo
silver grove
#

It's step 5 in the guide I shared above

#

Sorry, can you share more details?
Like what information are you trying to submit to your backend?

sacred echo
silver grove
#

Gotcha. There are two options I can think of right now.

First option is,
Once the user is done configuring a dining menu, you save that in your Database before you create a PaymentIntent. Then when you create a PaymentIntent, you associate that PaymentIntent to the menu in your database. When the PaymentIntent is confirmed, you can call your server with the relevant PaymentIntent ID to mark that "order" as paid.

Second option is,
This option relies on Webhooks. Once the user is done configuring and you call your server to create a PaymentIntent - you send the menu details to the server. Then you store the menu details in PaymentIntent metadata. When that PaymentIntent is confirmed and payment succeeds, you look at the payment_intent.succeeded event's payload to figure out what PaymentIntent was confirmed and what was the associated menu in it's metadata . Then you can store the menu from the metadata in your own Database

#

Option 1 is more static where the menu can exist in your database without the user paying for it.

Option 2 is more dynamic where the menu will only exist in your database if the payment is successful.

sacred echo
#

Okay ye does look like solid solutions, thx for the help i will go for second option