Created with Sketch.
Created with Sketch.
Checkout 3.0

Handling session timeout

Purchase session in Checkout needs to be completed in 30 minutes. If a purchase is not complete in required time frame, purchase state is change to “TimedOut“. (List of all states can be found in article Finalize Purchase). Timedout purchase can’t be completed anymore, this state is considered final for the session. This article describes how to handle session timeout seamlessly.

After the purchase is initialized (How to get started) we receive purchaseId, jwt, expiredUtc.

  • purchaseId – ID for session reference;
  • purchaseJWT – token used for displaying Checkout form (Embed Checkout Form);
  • expiredUtc – DateTime indicating when the purchase session will be expired and moved to state TimedOut if it was not yet completed by a customer.

Using expiredUtc

expiredUtc can be used as a time reference to trigger GetPaymentStatus for the purchaseId. If you find out from the response that the purchase is “TimedOut” it’s not needed to serve this purchase session to the customer. The customer will not be able to do anything to continue on that purchase. Instead you can reuse his current cart (if it’s persisted on your side) and initialize a new payment with the same contents to allow the customer to pay.

Using SessionTimedOut callback

If the sessionTimedOutCallback (more info about the callback Showing the Checkout Form) is triggered in the Checkout Form, current session is already timed out and it’s not possible to continue with the purchase. In order to prevent malicious use, use GetPaymentStatus to confirm the current session – purchaseId is really TimedOut and try to initialize a new payment if you can recover customers cart.

  var sessionTimedOutCallback = function() {

    // Handle the callback


    "sessionTimedOutCallback": sessionTimedOutCallback,