#wickedmishra

1 messages · Page 1 of 1 (latest)

gentle hearthBOT
exotic hound
honest sonnet
#

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:

  1. The "Pay Now" button should send a request to my backend
  2. The backend should create a Checkout Session and redirect the client to Stripe's checkout page
  3. 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.

exotic hound
#

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 your return_url on 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

Everything businesses need to know about chargebacks: What they are, what causes them, and how businesses can prevent chargebacks and friendly fraud.

honest sonnet
exotic hound
#

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

honest sonnet
honest sonnet
exotic hound
#

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

honest sonnet
#

Got it. Thanks.

exotic hound
#

Sure thing!