#mymodian_best-practices
1 messages ¡ Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- mymodian_best-practices, 1 day ago, 7 messages
- mymodian_best-practices, 1 day ago, 21 messages
- mymodian_best-practices, 4 days ago, 18 messages
- mymodian_unexpected, 5 days ago, 11 messages
- mymodian_docs, 6 days ago, 17 messages
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1257892258251018301
đ Have more to share? Add details, code, screenshots, videos, etc. below.
hello! The Subscription object itself doesn't have the Checkout Session id, why do you want to know which Checkout Session created the Subscription object? If you do want to know, when you receive the checkout.session.completed webhook event, you can find the subscription id in https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-subscription. You can make a subsequent request to set the Checkout Session id as metadata on the Subscription object.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
because i use Checkout Session to create a subscription for the customer, so when i recieve a customer.subscription.created event, i need to know which request generate the subscription.
like what i mentioned before, when you receive the checkout.session.completed webhook event, you can find the subscription id in https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-subscription. So you can save the Checkout Session id and Subscription id from the checkout.session.completed into your DB
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
the event sequence is random, it's so difficult to process all these correctly
if the invoice.paid event comes first, then i don't know who created it, i can't process it.
what do you mean by if you don't know who created it, you can't process it? can you elaborate more?
we need to process invoice.paid event to grant features to our user, after create a subscription checkout session, if the first incoming event is invoice.paid, i can't process it, because on my side the user has no subscription yet, and i can't know if it's generated by the pending subscription session.
just an invoice paid and no other information
Like what our docs mention in https://docs.stripe.com/webhooks#event-ordering, you'll want to retrieve any missing object if you receive a particular object first. If you receive the invoice.paid event first, you can check if your DB already has that subscription id. If it doesn't, make a request to retrieve the corresponding Subscription object and then create it in your DB first.
if we response 5xx code to the webhook call, will stripe still retry to delivery it?
yes, Stripe will attempt to redeliver as log as you don't send 2XX response
ok. thanks for your help, i have no questions now.