Cancel retries when using the decline recovery feature
---
tags: [recover]
---
| Background |
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Before starting this tutorial, make sure you understand the following topics from the [Quick start](doc:quick-start) section:<ul style={{ marginTop: "-5px", marginBottom: "-5px" }}><li>[Sandbox environments](doc:sandbox-environments) (especially about testing).</li><li>[Authentication](doc:authentication) (about authenticating using your API user and when you need a login versus a one-time-use token).</li></ul> |
Merchants can enable or disable retries for one or more transactions by using Nexio's [Decline recovery](doc:decline-recovery-overview) 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](ref:enableordisableretriesforasingletransaction) endpoint, [Enable or disable retries for multiple transactions](ref:enableordisableretriesformultipletransactions) endpoint, or through the Nexio Dashboard in the [Decline Recovery report](https://dashboard.nexiopaysandbox.com/reports/recoveries).
Using these tools to cancel transaction retries can be helpful for <Glossary>merchant</Glossary>s 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](ref:enableordisableretriesforasingletransaction) 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](ref:viewrecoverystatus) endpoint (as `id`).
* `isEnabledForRecovery` - Set the value of this parameter to `false` to cancel retries for the transaction.
```shell Example Request
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
}
NoteThe
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 aGET
request to the View a decline recovery record, using theretryId
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 (asretryId
). Or, get the value by sending aGET
request to the View recoveries endpoint (asid
).isEnabledForRecovery
- Set the value of this parameter tofalse
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.
Updated about 8 hours ago