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

60%of recurring-payment declines are insufficient funds (Mastercard data, FY 2024)
30 daysdefault monitoring window after a code 51 decline under Payment Alerts
1h–10dthe issuer's advised wait when a Merchant Advice Code 24 to 30 is returned

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.

MACIssuer adviceWhat to do
24Retry after 1 hourWait an hour. The issuer expects funds imminently.
25Retry after 24 hoursWait a day.
26Retry after 2 daysWait two days.
27Retry after 4 daysWait four days.
28Retry after 6 daysWait six days.
29Retry after 8 daysWait eight days.
30Retry after 10 daysWait ten days.
02Cannot approve at this time, try laterGeneric: wait at least a day.
03Do not try againStop. Every further attempt attracts a fee.
21Recurring payment cancelledStop billing this card. Contact the customer.
40Non-reloadable prepaid cardDo not retry. The card will never have funds again.
Merchant Advice Codes 24 to 30: the issuer's advised wait before retrying a code 51 decline, from one hour to ten days Code 51 decline MAC · wait 24 1 hour 25 24 hours 26 2 days 27 4 days 28 6 days 29 8 days 30 10 days
Merchant Advice Codes 24 to 30 are the issuer's estimate, made at the moment of the decline, of when the account will be funded again. Retrying before the advised wait spends an attempt for nothing.

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.

01

A schedule

Day 3, day 5, day 7. Knows nothing about the cardholder. Hits paydays by accident and misses them by accident.

Sees: nothing about the account
02

A prediction

Smart Retries, Revive, Auto Rescue. A model picks a better moment from paydays, time of day and the card's history.

Sees: patterns in past attempts
03

A network signal

Mastercard monitors the card after the decline and signals when a retry is more likely to approve. Delivered as a RETRY_NOW webhook.

Sees: conditions inside the network

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.

PlatformHow code 51 appearsWhere to find it
Stripeinsufficient_fundsdecline_code on the payment error; invoice.payment_failed webhook
BraintreeProcessor response 2001 Insufficient FundsTransaction processor response code
AdyenRefusal reason NOT_ENOUGH_BALANCErefusalReason / raw acquirer response 51
Chargebee, Recurly, ZuoraGateway error text such as "insufficient funds"Transaction / payment error detail, with the raw gateway code
Direct acquirer / ISO 8583DE39 = 51Authorization 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

  1. Store both codes. Response code and, on Mastercard, the Merchant Advice Code, on every decline.
  2. Honour the advice code. MAC 24 to 30: do not retry before the stated wait. MAC 03, 21 or 40: stop.
  3. Use a signal where you have one. Under Payment Alerts monitoring, wait for RETRY_NOW and retry immediately. Approval likelihood decays with delay.
  4. Fall back to timing heuristics for cards without a signal: paydays, mid-morning local time, at least a day between attempts.
  5. Cap attempts at three or four, well inside the network limits.
  6. 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.
  7. 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.