Execute Recovery
The core recovery endpoint. When a payment fails in your billing system, call this to trigger the intelligent recovery engine.
Rate limit: 60 requests per minute per API key.
Response Summary
| Status | Meaning |
|---|---|
200 + success: true | Payment recovered immediately |
200 + success: false | All strategies exhausted, payment not recovered |
202 | Queued for smart-time retry |
403 | Blocked by risk engine — do NOT retry |
409 | Duplicate request (idempotency key already used) |
429 | Rate limit exceeded |
Decline Codes
| Category | Example Codes | What Happens |
|---|---|---|
| Recoverable | insufficient_funds, do_not_honor, call_issuer, try_again_later, card_declined | Optimal recovery strategy applied |
| Authentication required | authentication_required | No retry — issuer needs the customer to authenticate. 403 returned, webhook fired |
| Blocked | fraudulent, lost_card, pickup_card, restricted_card | Transaction blocked, webhook fired |
| Unknown | Any unrecognised code | Conservative recovery attempted |
Authorizations
Your Revtain API key (format: rev_xxx). Provided during onboarding.
Body
Your gateway's payment token. Format varies per gateway — see the full per-gateway token-format table at Supported Gateways.
Common examples:
- Stripe:
pm_xxx(PaymentMethod ID) — works for cards, Apple Pay, Google Pay - Checkout.com:
src_xxx(saved instrument token) - Adyen:
<merchantAccount>|<storedPaymentMethodId>|<shopperReference> - Braintree:
<paymentMethodToken>|<customerId> - GoCardless:
<mandateId>(MD-xxx) - PayPal:
billing-agreement|<BA-token>orreference|<previous-payment-id>
Apple Pay and Google Pay tokens issued by your gateway work the same way as card tokens — pass them as the underlying gateway token, and set paymentMethodType to identify the wallet.
"pm_1234567890"
Amount in the smallest currency unit (e.g., 5000 = $50.00 USD). For zero-decimal currencies (JPY, KRW, VND), pass the whole amount.
50 <= x <= 1000000005000
Optional list of alternative payment tokens for the same customer (for example, a backup card-on-file when the primary is a wallet). When the primary token's gateway cascade exhausts on a recoverable decline (insufficient funds, do not honor, gateway timeout, and similar), Revtain automatically tries each fallback token in order — no orchestration code on your side.
Tokens that fail with hard cardholder-state declines (lost, stolen, fraud, expired) skip the fallback step, because the issuer's flag applies to the cardholder rather than the individual token.
Pass the tokens in priority order. Up to 5 supported.
5[
"pm_card_backup_5678",
"pm_secondary_card_9012"
]3-letter ISO 4217 currency code.
"USD"
The decline code from your processor. Dramatically improves recovery rate.
"do_not_honor"
2-letter ISO country code of the card issuer. Enables geographic routing optimisation.
"US"
Unique key to prevent duplicate recovery attempts. Strongly recommended for production.
128"order_12345_retry_1"
First 6 digits of the card (BIN). Enables issuer-level analytics and smarter routing.
"411111"
The end customer's email address. Required if dunning is enabled.
"customer@example.com"
How the customer originally paid. Lets Revtain apply the right recovery strategy per rail — wallets get a higher predicted-recovery score and skip cascades to gateways that don't support recurring wallet charges.
Defaults to card when omitted. Always pass this if the failed payment
originated via Apple Pay, Google Pay, PayPal, or Venmo — recovery rates
are materially higher when set correctly.
card, apple_pay, google_pay, paypal, venmo "apple_pay"
Set to true if this failure occurred on the customer's first paid charge
after a free trial. Trial-conversion failures get prioritised in the cascade
(effective priority bumps to critical) — losing the customer at the
trial-to-paid moment is the highest-cost churn event a subscription business
faces.
true
Sandbox only. Force a specific outcome for testing. Only honoured when primary gateway is a Test Gateway.
success, failed, blocked Response
Recovery attempt completed (check success field for outcome)