#wickedmishra
1 messages · Page 1 of 1 (latest)
Here's a doc on order fulfillment with Checkout: https://stripe.com/docs/payments/checkout/fulfill-orders
We can't really speak to what happens when you don't fulfill an order. I wish I could help, but this chat is focused on developers and API integration questions.
Thanks. I already went through the documentation and still have these questions.
Here's why I am asking this:
I am building a "Pay Now" button for a job listing. I need to update the status to "paid" once the payment is complete.
Here's what I understand from the documentation:
- The "Pay Now" button should send a request to my backend
- The backend should create a Checkout Session and redirect the client to Stripe's checkout page
- Upon successful completion, Stripe will send a Webhook event to fulfill my order (this is where I can mark the status to "paid")
However, the Webhook can fail or get delayed, right? In which case, the user could end up doing multiple payments.
A fix that I have in mind: while creating the checkout session, I store the checkout ID in my database with an order ID (app specific). When the user is trying to make a double payment, I could grab the checkout ID using the order ID from my database, query Stripe and understand if the payment was already done. In this case, I don't need the fulfillment event anymore.
Also, please validate my understanding: once the checkout is completed successfully, the payment amount collected by Stripe stays in my Stripe account, right? It doesn't get refunded to the customer based upon whether I fulfill the order or not using the Webhook.
However, the Webhook can fail or get delayed, right? In which case, the user could end up doing multiple payments.
That's true, but the customer gets redirected out of the stripe-hosted Checkout page, to a page you specify in yourreturn_urlon the Checkout Session object, so you can display a page that says something like, "thank you, your order is complete", which will solve the problem of potential double payments.
the payment amount collected by Stripe stays in my Stripe account, right? It doesn't get refunded to the customer based upon whether I fulfill the order or not using the Webhook.
Correct, though if you don't fulfill the order, you will likely get chargebacks as your customers reach out to their banks to complain: https://stripe.com/resources/more/chargebacks-101
Understood. Let me put it in more context. Every user has a dashboard wherein they can see their job listings along with their payment status.
Even if we send them to a page that says "Your Payment was successful", when they come back to the dashboard, they'll still see "payment-pending" as my backend didn't get the Webhook request to fulfill the order yet.
I see what you're saying. It might be worth building in a fallback in that case that does a scheduled retrieval of payments to sync your system with stripe's then
Thanks for this. If I make sure the payment status is updated to "paid" correctly without the fulfillment event (see my fix in the earlier message), then it's not needed, right?
Also, the document mentions that the Webhook events are retried until 3 days. What happens if my backend is still unable to process the events?
Thanks. Is there a place where I can read about similar use cases from other developers?
then it's not needed, right?
That's correct, this might be a more elegant solution, though it relies on the customer coming back in order to update state, so if it were me I would probably combine both this method and the daily batch retrieval that I mentioned previously
Also, the document mentions that the Webhook events are retried until 3 days. What happens if my backend is still unable to process the events?
We stop retrying and you have 15 days to fix it and retry the events manually
Got it. Thanks.
Sure thing!