#jasonadams1326_best-practices
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/1262877041544527913
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there
Hi!
Do you happen to have a webhook endpoint that listens for checkout.session.completed events by any chance?
Yes I do
The reason I ask is we wait until your endpoint responds to this event to redirect customers to the success_url : https://docs.stripe.com/checkout/fulfillment#redirect-hosted-checkout
See the note here
If one or more endpoints that's listening for checkout.session.completed events does not acknowledege the event in a timely manner, we wait up to 10 seconds for a response before timing out and redirecting the customer to the success_url
hmm, i wonder if theres anything in my checkout.sessions.create call and/or my checkout.session.completedhandling in my Stripe webhook. Would it be helpful to share small code snippet? Its javascript
Our general recommendation is to reply to the event delivery with a 200/ack as soon as possible and complete any handler logic after the fact
I do have a webhook endpoint set up to listen for checkout.session.completed events and I do set a success_url, but as far as I can tell, I'm not doing anything that would cause my server to respond slowly to the checkout.session.completed event
The Checkout Session won't be completed instantly after clicking Pay since a few things need to happen on the backend: creation of a Customer (unless you passed a Customer ID when creating the Session), creation of the Subscription, creation of the Invoice, creation of the child PaymentIntent
Gotcha. The only thing I'm doing before returning 200/ack is patching user in db (updating stripe customer id and subscriptionid in my db). Shouldn't take more than a few ms
That's good to know/understandable...but since I'm only creating checkout sessions for new users, I don't guess it would be any faaster to create a customer first in order to pass in a customer ID
Right, probably not. You could test whether updating your database after the 200/ack makes a significant difference
Ok thank you. I will look into that.
added timer logs and tested in my production environment (3 times). My database update on slowest attempt took 11.424ms, the time for the entire webhook to respond to Stripe with 200/ack was 12.326ms (other two tests were faster at around 6ms/7ms).
As a new Stripe customer, I understand I don't get charged for transaction fees for the first year (which is ofc awesome)...but does that put me on some sort of slower tier for checkouts?