Reputation: 13733
Imagine the following case:
I had an idea to use a valid test card first and then create another payment method with an expired card. However, Stripe won't allow me to add that kind of payment methods.
How can I test this scenario?
Upvotes: 3
Views: 2281
Reputation: 43
Hey I have found a work around, I couldn't find a dedicated solution.
I have used test clocks, stripe cli.
Steps:
Step3,Step5,Final Dashboard Screenshot
This question is the same and shows the bug in test clocks.
Upvotes: 2
Reputation: 1354
Stripe has a great test card[1] for this kind of error. You can add it to a customer but it will fail any payment.
4000000000000341
Attaching this card to a Customer object succeeds, but attempts to charge the customer fail.
For this kind of test, I typically create a customer, attach that card to them, and create a subscription with a trial period[2] of 10 seconds. After the trial is over, I manually finalize and try to take payment on the invoice to cause the renewal failure.
[1] https://stripe.com/docs/testing
[2] https://stripe.com/docs/api/subscriptions/create#create_subscription-trial_end
Upvotes: 4