Cancel retries when using the decline recovery feature

Background
Before starting this tutorial, make sure you understand the following topics from the Quick start section:

Merchants can enable or disable retries for one or more transactions by using Nexio's Decline recovery feature when a transaction is declined. Transactions that are scheduled for a retry can be canceled through the Enable or disable retries for a single transaction endpoint, Enable or disable retries for multiple transactions endpoint, or through the Nexio Dashboard in the Decline Recovery report.

Using these tools to cancel transaction retries can be helpful for merchants who want to cancel further retries before reaching a maximum retry limit.

Canceling transaction retries can also be helpful when a customer cancels a subscription while their payment is scheduled for a retry. The merchant can then disable retries for that subscription transaction to avoid paying future refunds.

Cancel a retry for a single transaction

To cancel a retry for a single transaction, send a PUT request to the Enable or disable retries for a single transaction endpoint. Include the following parameters in your request:

  • id - The retry ID. Get this value from the DECLINE_RECOVERY webhook event type (as retryId). Or, get the value by sending a GET request to the View recoveries endpoint (as id).
  • isEnabledForRecovery - Set the value of this parameter to false to cancel retries for the transaction.
curl --request PUT \
--url https://api.nexiopaysandbox.com/recovery/v3/enable \
--header 'Authorization: Basic [Base64_encoded_login]' \
--header 'Content-Type: application/json' \
--data '{
          "id": 4753537,
          "isEnabledForRecovery": false
        }'

After a successful request, the system returns a response similar to the following:

{
  "id": 4753537,
  "isEnabledForRecovery": false,
  "success": true
}

📘

Note

The success parameter refers to whether the API request was sent successfully. It does not mean that the transaction was successfully enabled or disabled for decline recovery. To check the status of the transaction, send a GET request to the View a decline recovery record, using the retryId as the path parameter.

Cancel retries for multiple transactions

Using this endpoint allows you to cancel retries for multiple declined transactions in a single request to the Nexio API. To cancel retries for multiple transactions, send a PUT request to the Enable or disable retries for multiple transactions endpoint.

Your request contains a "retries" array with each object of that object containing the following parameters:

  • id - The retry ID. Get this value from the DECLINE_RECOVERY webhook event type (as retryId). Or, get the value by sending a GET request to the View recoveries endpoint (as id).
  • isEnabledForRecovery - Set the value of this parameter to false to cancel retries for the transaction.
curl --request PUT \
--url https://api.nexiopaysandbox.com/recovery/v3/bulkEnable \
--header 'Authorization: Basic anNtaXRoQG5leC5pbzpTYWdpbmF3MTEh' \
--header 'Content-Type: application/json' \
--data '{
           "retries": [
             {
               "id": 4753555,
               "isEnabledForRecovery": false
             },
             {
               "id": 4753556,
               "isEnabledForRecovery": false
             }
         ]
       }'

After the request has been sent, a response is received from the Nexio API. The success parameter on each transaction added in the request will show "true" in the response if your request was successful for that transaction.

After a successful request, the system returns a response similar to the following:

{
  "retries": [
    {
      "id": 4753555,
      "isEnabledForRecovery": false,
      "success": true
    },
    {
      "id": 4753556,
      "isEnabledForRecovery": false,
      "success": true
    }
  ]
}

Cancel retries for one or more transactions through the Nexio Dashboard

For instructions on how to cancel a retry for one or more transactions through the Nexio Dashboard using the Decline Recovery report, view this article.