r/payments • • 16d ago

Made a free open-source npm package to classify Stripe decline codes

While working on failed payment recovery, I kept writing the same logic again and again: which decline codes are worth retrying, which ones need the customer to update the card, and what message to show them.

So we packaged it as stripe-declines. For each of the 51 decline codes it gives you:

  • what it means
  • whether a retry can succeed
  • who can fix it (the bank, the customer or you)
  • what to do next
  • a message to show the customer at checkout or on a billing page
  • a customer email template

In English and French.

A few things it handles that I’ve seen go wrong a lot: advice_code is not the decline reason, a dispute’s reason is not a decline, and a Radar-blocked charge should not be retried.

It’s open source (MIT).
npm: https://www.npmjs.com/package/stripe-declines
GitHub: https://github.com/flowmrr/stripe-declines
No code needed? Same rules in a free web tool: https://flow-mrr.com/en/tools/card-decline

Built by the FlowMRR team. Feedback welcome, especially on codes we classify wrong or edge cases you’ve seen in production.

2 Upvotes

0 comments sorted by