I am trying to test a scenario where the user's card has insufficient funds.
Following the docs at https://stripe.com/docs/testing - the cardnumber 4000 0000 0000 0002
should yield such an error. The source is considered valid
in the Stripe SDK, and it generates a source token
, but when calling their create_source
API, It comes back with a Request req_nGnzPdJHjw4lrk: Your card was declined.
-message, even though I have not created any charge yet.
The documentation at https://stripe.com/docs/saving-cards states:
Stripe validates card information when it is saved. This does not guarantee that any future charges succeed (e.g., the card no longer has sufficient funds, is reported lost or stolen, or if the account is closed). This process also includes the results of any checks, including traditional bank checks by Radar (e.g., CVC or postal code), that may have been performed.
So my question is, how do I test a scenario when a card is accepted by stripe, but during the moment of capturing a charge has insufficient funds?