Retries in AutoPay
The AutoPay system has an automatic retry mechanism designed to ensure the continuity of collections in the event of temporary connection failures or unavailability of external services. The workflow includes four key points that utilize this mechanism, which are detailed below.
Generation
In this workflow, the system identifies that a payment needs to be collected and prepares the information to generate it. This is where the balance inquiry is performed with the merchant's external service.
Balance Inquiry
The system determines whether to check the amount to be charged based on the charge type configured in AutoPay (See Charge Types Details).
The charges that require consultation are:
- Total Balance (
TOTAL_BALANCE): The total outstanding balance for the current period is checked with the merchant's service. - Minimum Balance (
MINIMUM_BALANCE): The minimum balance required to maintain active service is checked, according to the merchant's report.
Retry Frequency
If an error occurs while trying to check the balance or register the payment for the first time, the system will execute up to two additional payment registration attempts, based on the following time intervals:
Attempt Limit
If the payment cannot be registered after 3 attempts, the system will give up and the AutoPay will be marked as
failed (FAILED).
If this process fails, not only is the current payment affected, but the status of all pending installments
(FAILED) that already existed for that AutoPayment is updated.
Processing
Once the payment is generated with the corresponding amount, the transaction is processed against the payment method.
Retry Frequency
In the event of actionable rejections or technical communication errors with the gateway, the system will perform up to 2 retries at the following time intervals:
Amount Consistency
During these new payment attempts, the balance is not checked again. This process is performed only during the installment registration stage to ensure consistency in the amount charged.
Attempt Limit
This flow currently has a maximum of 3 attempts. If this limit is reached without approval, the following actions will be executed:
- The current payment and AutoPay change to failed status (
FAILED). - If there are pending payments, their status will change to failed (
FAILED). - The recurrence cycle stops.
Settlement
This process is executed only when a AutoPay payment has been approved. Its purpose is to inform the merchant's external service that the payment has been successfully completed.
Retry Frequency
If the merchant service does not respond or fails to confirm the settlement, the system will make up to 2 retries during the following time intervals:
Settlement Failure
After exhausting the 3 attempts to use the external service, the Self-Pay system records a failure warning in the logs.
Notification
This flow is responsible for informing the merchant's system about the outcome of different events related to a AutoPay transaction.
Retry Frequency
If the merchant's server does not return a satisfactory response, the system will make up to 2 retries at the following time intervals:
Delivery Failure
After exhausting the 3 notification attempts, the system stops automatic sending and generates an error log detailing the event that was not reported.