Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a timeout for a stripe session checkout?

Is there a timeout for a customer to make their payment and can it be changed ?

Let me explain my situation :

I have to add the payment on a PHP booking platform.

To ensure that a time slot is not reserved several times, the platform blocks the reservation for 20 minutes when the user clicks on the reserve button. If he has not completed filling in his information after this time, he must start again or if he does not finish, the reservation is released.

I should be able to make sure that the payment is a maximum of 5 minutes long. In this way, I initiate the payment after maximum 15 minutes after the start of the reservation.

It’s the easiest way I’ve found to not touch up the whole code. Unfortunately, I can't find this option in the API.

Otherwise, if I block the reservation permanently before the payment process, I have no method to unblock it if the user does not complete the transaction by closing their browser.

like image 707
darkdiamond Avatar asked Jul 08 '20 14:07

darkdiamond


People also ask

How long does a Stripe Checkout session last?

Checkout Sessions expire 24 hours after creation. After creating a Checkout Session, redirect your customer to the URL returned in the response.

Can you customize Stripe Checkout?

You can customize the look and feel of Checkout in the Stripe Dashboard. Go to Branding Settings where you can: Upload a logo or icon. Customize the Checkout page's background color, button color, font, and shapes.

What is Stripe Checkout session?

The Checkout Session provides a URL that redirects customers to a Stripe-hosted payment page. Customers enter their payment details on the payment page and complete the transaction. After the transaction, a webhook fulfills the order using the checkout. session.


1 Answers

When a Checkout Session is created it has a Payment Intent associated with it. You can cancel that Payment Intent when you release the reservation, which will prevent the customer from paying.

Update: You can now set expires_at when creating the Checkout Session:

The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 1 to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation.

You can also now explicitly and immediately expire a Checkout Session using the dedicated "Expire a Session" API endpoint.

like image 196
Justin Michael Avatar answered Oct 27 '22 11:10

Justin Michael