What code 51 means
Every card authorization returns a response code, standardised in ISO 8583 as data element 39. Code 51 is insufficient funds: the issuing bank looked at the account and found the available balance or credit line could not cover the amount requested.
Three things follow from that definition. The card exists and is active, or the issuer would have returned a different code. The cardholder has not cancelled anything. And the only variable between this failed attempt and a successful one is money arriving in the account.
Note the word available. Available balance is the ledger balance minus pending authorizations, holds and, on some cards, a daily spending allowance. A customer can have money in the account and still return code 51 because a hotel hold or a pending transfer is sitting on it. That is one reason retrying a few hours later sometimes works, and one reason it often does not.
Why it dominates recurring billing
On one-off checkouts, insufficient funds is one decline reason among many. On recurring payments it is the reason. Mastercard's data across all card types puts insufficient funds at roughly 60 percent of recurring-payment declines. The rest is split between expired and replaced cards, limits, do-not-honor responses and everything else.
The reason is structural. A subscription renews on the merchant's date, not the customer's payday. Debit cards, which make up a large and growing share of subscription payments, draw on a current-account balance that cycles from full to empty every month. Bill the wrong day and the card declines even though the same customer approved happily the month before.
That also makes code 51 the decline where recovery is worth the most. The customer wants the product. There is nothing to fix on the card. All you have to do is ask again at the right time.
The Merchant Advice Codes that come with it
On Mastercard, a decline can carry a second piece of information alongside the response code: a Merchant Advice Code (MAC), sent in data element 48, sub-element 84. Where the response code says what happened, the advice code says what the issuer thinks you should do about it.
For insufficient-funds declines on recurring card-not-present transactions, Mastercard's Authorization Optimizer programme asks participating issuers to return a time-boxed advice code. It has applied in the United States since October 2023 and in Europe since January 2024.
| MAC | Issuer advice | What to do |
|---|---|---|
24 | Retry after 1 hour | Wait an hour. The issuer expects funds imminently. |
25 | Retry after 24 hours | Wait a day. |
26 | Retry after 2 days | Wait two days. |
27 | Retry after 4 days | Wait four days. |
28 | Retry after 6 days | Wait six days. |
29 | Retry after 8 days | Wait eight days. |
30 | Retry after 10 days | Wait ten days. |
02 | Cannot approve at this time, try later | Generic: wait at least a day. |
03 | Do not try again | Stop. Every further attempt attracts a fee. |
21 | Recurring payment cancelled | Stop billing this card. Contact the customer. |
40 | Non-reloadable prepaid card | Do not retry. The card will never have funds again. |
Two implications. First, if your billing system stores the response code but throws away the advice code, it is discarding the issuer's own retry guidance. Most processors surface it; Stripe exposes it as the network advice code on the payment error. Second, the advice code is the issuer's estimate at the instant of the decline. It cannot tell you whether the estimate turned out to be right.
What retrying costs
A retry is not free, and the networks have spent the last few years making sure merchants notice.
Processing fees. Every authorization attempt carries an authorization fee from your acquirer and processor, approved or not. Ten attempts on one invoice is ten fees for one recovery at best.
Visa Excessive Reattempts. Visa allows at most 15 reattempts on the same card at the same merchant within 30 days and charges for attempts beyond that. Some Visa decline categories are designated do-not-retry outright.
Mastercard Transaction Processing Excellence. Mastercard's programme charges an excessive authorization attempts fee on declined attempts beyond its thresholds, framed around limits per card within 24 hours and within a rolling 30-day period, plus a separate fee on every attempt after a MAC 03 or 21. Amounts and thresholds are set in network bulletins and passed through by acquirers, so confirm the current figures with yours.
Issuer reputation. The quiet cost. Issuers see every authorization you send. A merchant that retries insufficient-funds cards daily looks like a merchant with weak controls, and issuers respond by tightening risk models on that merchant's future traffic. That shows up as more do-not-honor declines on customers who should have approved.
The arithmetic. Each attempt that had no realistic chance of approving is pure cost. A retry policy that only sends attempts likely to approve recovers more revenue, pays fewer fees, and improves first-attempt approval rates at the same time.
Three ways to time the retry
Since the only thing that changes between a code 51 decline and a successful retry is money arriving, the entire problem is timing. There are three ways to decide when.
1. A schedule
Day 3, day 5, day 7. Or day 1, 3, 7, 14. This is what most billing platforms ship with, and what WooCommerce Subscriptions, Braintree recurring billing and Recurly's default retry rules do. The schedule knows nothing about the cardholder. It hits paydays by accident, and misses them by accident. Its one virtue is that it exists.
2. A prediction
Stripe Smart Retries, Chargebee Revive, Adyen Auto Rescue and the third-party recovery layers built on top of Stripe all use models to predict a better moment: the first and fifteenth in the US, month end in much of Europe, mid-morning in the cardholder's time zone once deposits have cleared, the day of week this card has approved before. Genuinely better than a schedule. Still a guess, made by a system that cannot see the balance and learns only when it tries. Each failed prediction spends an attempt and a fee.
3. A signal from the network
The third option is newer and narrower. After an insufficient-funds decline, Mastercard's Payment Optimization Platform can monitor the card inside the network, for up to 30 days, and emit a signal when conditions indicate a retry is more likely to approve. It is an observation, not a prediction, made where the money actually moves.
PaymentRetryAlert delivers that signal to your webhook as a RETRY_NOW alert with the identifiers
needed to match it to the original decline. You retry through your existing processor. If your own retry
approves first, monitoring cancels itself. It covers Mastercard codes 51 and 61 on recurring transactions
only, which happens to be the largest and most time-sensitive slice of the problem.
The sensible combination is all three: keep the scheduler for breadth, respect the issuer's advice code so you do not waste an early attempt, and act on the network signal the moment it arrives.
Code 51 on Stripe and other platforms
Processors rename the code. Knowing the mapping helps when you are classifying declines.
| Platform | How code 51 appears | Where to find it |
|---|---|---|
| Stripe | insufficient_funds | decline_code on the payment error; invoice.payment_failed webhook |
| Braintree | Processor response 2001 Insufficient Funds | Transaction processor response code |
| Adyen | Refusal reason NOT_ENOUGH_BALANCE | refusalReason / raw acquirer response 51 |
| Chargebee, Recurly, Zuora | Gateway error text such as "insufficient funds" | Transaction / payment error detail, with the raw gateway code |
| Direct acquirer / ISO 8583 | DE39 = 51 | Authorization response, with MAC in DE48 SE84 |
On Stripe specifically, the invoice.payment_failed event carries the attempt count and the next
scheduled attempt, and the underlying payment error carries both the decline code and the network advice
code. A handler that stores the invoice ID, card BIN and last four, amount, currency and decline time has
everything it needs to match a later network signal and call the invoice pay endpoint. See the guide to
Stripe Smart Retries for the full flow.
A retry policy for code 51
- Store both codes. Response code and, on Mastercard, the Merchant Advice Code, on every decline.
- Honour the advice code. MAC 24 to 30: do not retry before the stated wait. MAC 03, 21 or 40: stop.
- Use a signal where you have one. Under Payment Alerts monitoring, wait for
RETRY_NOWand retry immediately. Approval likelihood decays with delay. - Fall back to timing heuristics for cards without a signal: paydays, mid-morning local time, at least a day between attempts.
- Cap attempts at three or four, well inside the network limits.
- Pause dunning until retries are exhausted. An email asking the customer to update a card that is about to approve on its own costs you goodwill for nothing.
- Measure recovery per attempt. If your fourth attempt approves a few percent of the time, remove it and keep the fee.
When a retry is not the answer
Some code 51 declines should not be retried at all, and the advice code usually tells you which.
- Non-reloadable prepaid cards (MAC 40). The balance is spent and will not return. Ask for another payment method.
- Single-use virtual cards (MAC 41). The number was good for one transaction.
- Cancelled recurring payments (MAC 21). The customer told their bank to stop. Retrying is a compliance failure, not a recovery tactic.
- Repeated code 51 across several cycles. A customer who declines for insufficient funds every month is telling you something about affordability. A smaller plan or a different billing date recovers more than another retry.
For every other code 51, the answer is a retry, timed as well as your information allows. The better the information, the fewer attempts it takes.
- Mastercard, Decline details and Merchant Advice Codes
- Mastercard, Turn more declines into approvals with smarter payment optimization
- Braintree, Mastercard network updates: Authorization Optimizer programme
- Stripe, Decline codes
- Chargebacks911, Visa Excessive Reattempts rule
- Insufficient-funds share of recurring declines: Mastercard data, all card types, FY 2024.