Mirror318
Mirror318

Reputation: 12693

Stripe—test cards with insufficient funds

There are some test credit card numbers, e.g. Visa's 4111 1111 1111 1111, and when you test with these cards, it is always a successful transaction.

How do I test a declined transaction? E.g. if the card is valid but doesn't have enough money for the transaction?

Upvotes: 21

Views: 35549

Answers (4)

Zia
Zia

Reputation: 683

4000000000009995 this card number return insufficient funds when I attach it to a customer. I hope it help someone.

Upvotes: 2

Giovanni Benussi
Giovanni Benussi

Reputation: 3530

You have two scenarios when a charge can fail:

  • Charge directly a customer.
  • Attach a card to a customer and then try to charge that customer.

Stripe's documentation provides two test cards for those situations:

  • 4000 0000 0000 0002 "Charge is declined with a card_declined code."
  • 4000 0000 0000 0341 "Attaching this card to a Customer object succeeds, but attempts to charge the customer fail."

Upvotes: 51

Mirror318
Mirror318

Reputation: 12693

As @Muistooshort and @phlip mention in the comments, the Stripe documentation give a list of test cards that will return various error messages.

Common errors would be:

4000 0000 0000 0002 Card declined (e.g. insufficient funds)

4000 0000 0000 0069 Card expired

4000 0000 0000 0127 Incorrect CVC

Card dates can be anything in the future (for valid dates) or in the past to test invalid dates.

Upvotes: 5

postmoderngres
postmoderngres

Reputation: 386

You can use the card number 4000 0000 0000 0002 or token "tok_chargeDeclined" to get a declined test charge: https://stripe.com/docs/testing#cards

Upvotes: 13

Related Questions