Timeout Processes
Timeouts and You
All transactional events over the internet have the potential to fail due to network conditions and subsequently timeout. When dealing with payment cards and live traffic, this is particularly troublesome and — if handled incorrectly — an operational pain point.
This article provides a guide on how the platform handles timeouts and how you, as an integrator, should consider timeouts in your design.
What Happens When a Timeout Is Received?
A timeout is an unknown outcome. The payment may have been approved, declined, or never reached the bank. Don't treat it as a decline, and don't take another payment from the customer until you know what happened to the first one. If the original was approved, a second payment charges the customer twice.
The platform records the timed-out attempt and starts trying to reverse it (see How We Fix a Timeout). That reversal runs in the background, can take time, and isn't guaranteed to succeed. The platform doesn't notify you of the final outcome, so your integration needs to check.
What your integration should do
- Set your client timeout to at least 100 seconds. The platform can wait up to 90 seconds for a downstream response. A shorter client timeout can give up before the platform's own response arrives.
- Treat a timeout or a timeout response code as unknown. This applies when your request times out, or when the response has code
99,797,798or799. Don't fulfil the order, and don't charge again yet. - Look up the outcome. Query the transaction with the Dynamic Query API (
POST /merchanthub/api/v1/dynamicquery/transaction/list), filtering on themerchantReferenceyou sent and a time window around the attempt. If you have the originaltxnReference, filter on that instead. - Act on what you find:
- Declined: the original didn't go through and no reversal was needed. It's safe to take the payment again.
- Approved - reversed: the original was approved and the platform has reversed it. It's safe to take the payment again.
- Approved: the platform hasn't reversed it yet. Wait and check again, and don't fulfil the order from the timed-out attempt. Reversal attempts can continue for up to about 90 minutes. If the original is still approved after that, contact Connected Payments Support before you charge again.
- Use a new
merchReferencefor every new attempt. A reused reference is rejected with716. If you authenticate with X-Signature, a reused reference returns the stored result of the first attempt instead.
More Information
Timeout Definition
Within the platform, a timeout is defined as any transaction where an adequate response is not received within the platform's timeout period (up to 90 seconds).
Once a timeout has occurred, a transactional record will be created with all associated transactional data and one of the following response codes:
| Response Code | Description |
|---|---|
99 | Standard timeout |
797 | Timeout variant |
798 | Unknown exception (timeout-like) |
799 | Unknown exception (timeout-like) |
A 99 can arrive with HTTP 200 or HTTP 504, depending on where in the platform the timeout happened. Check the responseCode, not only the HTTP status.
Causes
A traditional timeout is caused by the lack of a response from a downstream gateway or link within the pre-defined timeout period. This may result from:
- No response within the timeout period
- Partial response within the timeout period
- Unintelligible response within the timeout period
All causes above are defined as a "gateway timeout" as an intelligible response was not received within the pre-defined period.
Transactional State
When a timeout occurs, one of 3 transactional states may be found within the downstream service's records:
| State | Description |
|---|---|
| Approved | Transaction was approved downstream before the timeout was recorded |
| Declined | Transaction was declined downstream |
| No Record | No downstream transactional record found |
The platform works to reverse an approved timed-out transaction, but you should still confirm the outcome before charging the customer again (see What your integration should do).
How We Fix a Timeout
Once a timeout occurs, it is added to the Connected Payments timeout queue. Within this queue, each timeout will be queried and a reversal submitted on repeat until one of the following events occurs:
- Settlement date for the original transaction passes
- Retry attempts are exhausted
- The transaction is confirmed as declined
- The transaction is successfully voided
Each retry attempt begins with a query of the originally timed-out transaction:
- If the query reveals the transaction is declined or approved but voided/cancelled, no further attempts are made
- If the transaction is found in an approved state, a void request is sent to cancel it and prevent any financial action from taking place
Timeline
- The first reversal attempt starts within a few seconds of the timeout.
- Attempts repeat up to 11 times, over about 90 minutes in total.
- A reversal can still fail. If it does, the original transaction stays approved. This is why you check the outcome before charging again.