Polling Best Practice
Here is a general algorithm to ensure that you successfully retrieve transaction results as consistently as possible. The time intervals below are offered as suggestions, feel free to make adjustments based on your own business applications.
- Begin polling from the time the transaction is submitted (or sent to the payment terminal, if applicable). Continue issuing GET requests every 3-5 seconds for the first 3 minutes.
- HTTP 404 – Not Found: (No response example)
- Continue polling, transaction results aren’t available yet.
- HTTP 200 – OK: (Approved response example)
- Stop polling, digest transaction response.
- HTTP 404 – Not Found: (No response example)
- If no transaction results after 3 minutes, send a transaction cancellation request.
- Display a message to the user saying “Transaction Failed, Please Try Again”.
- Move the transaction to a queue for background polling. Begin issuing GET requests every 30 seconds for another 30 minutes.
- If results are returned in the background as an approval, issue a void request for that transaction.
- If results are returned as a decline, cancellation, or other failure, remove the transaction from the polling queue.
- If no results are returned after 30 minutes, flag the transaction for manual review.