How to handle failed transactions and implement recovery flows in semi-integrated environments — what triggers recovery, how PayFacto and the terminal recover a transaction result, and what merchants need to do when they receive a PR return code.
Version: v1.0 | Last updated: 2026-06-29
Recovery is an integration principle for semi-integrated terminals used to recover a response when certain situations occur during a transaction. After the transaction completes, these situations prevent PayFacto from providing a return code immediately. The most common situations requiring recovery are communication problems between the PayFacto applications and the terminal.
The return code to monitor is PR. PayFacto invokes the PR return code for any situation that does not immediately obtain a return code.
There are two distinct recovery transactions performed in this process:
PayFacto Server → Terminal
PayFacto's servers send a recovery request to the terminal to retrieve the result of a transaction that returned a PR code.
Merchant Application → PayFacto Server
The merchant's application sends a recovery request to PayFacto's servers through the API to retrieve the transaction result.
When a transaction generates a PR error code, the PayFacto servers automatically initiate a recovery that is sent to the terminal.
If the terminal is not connected in ECR mode, the PayFacto servers will continue sending the recovery to the terminal to obtain the transaction result every 30 seconds until the terminal reconnects to ECR mode. This results in one of two outcomes:
Merchant Sends a New Transaction First
If the merchant's application sends a transaction (purchase, refund, etc.) before the PayFacto servers receive the result of the recovery sent to the terminal, the merchant application receives error code 3667 (semi-integrated terminal is busy completing the recovery) or 3668 (semi-integrated terminal is waiting for a recovery).
Merchant Sends a Recovery First
If the merchant's application sends a recovery through the API before the PayFacto servers receive the result of the recovery sent to the terminal, the merchant application receives the PR error code again on the recovery. This recovery can be performed by the merchant's application at any time to obtain the result of transactions that received a PR — for example, 45 seconds afterward, or in batch at the end of the day. However, if the terminal never reconnects to ECR mode, the merchant's application will continue to receive the PR error on the recovery until the PayFacto servers are able to reach the terminal and receive the response.
After the PayFacto servers receive the result of the recovery, the merchant's application can initiate and process a new transaction. There is unfortunately no easy way to know in advance whether the PayFacto servers have been able to communicate with the terminal and retrieve the transaction result.
From the moment the terminal reconnects to ECR mode, it can take up to 30 seconds before the PayFacto servers are able to perform the recovery with the terminal.
If You Receive Error 3667 or 3668
Verify that the terminal is connected to the network and in ECR mode, and wait at least 30 seconds before sending a new transaction.
To start the recovery process as soon as possible when the merchant application receives the PR return code, it is necessary to:
Check the transaction receipt
Check the return code printed on the transaction receipt.
Verify the serial connection
Make sure the terminal is securely connected to the set (if integrated with a serial cable).
Verify network connectivity
Ensure that the terminal can communicate with PayFacto — that there is no network failure.
Verify the power connection
Make sure that the terminal's power cable is securely connected and locked.
Important
The transaction receipt is always right. In the event of a discrepancy between the transaction receipt return code and the merchant API, the transaction receipt code prevails. PayFacto uses the PR return code to inform the merchant that they must pay close attention to the transaction receipt.
The merchant must ensure that the PIN pad is properly and securely connected at all times to allow recovery and batch closure as quickly as possible.