Stripe - add an invalid card to customer in test mode?

ruby-on-rails, stripe-payments, vcr

Solution

Answer is: 4000 0000 0000 0341 card number. Described in https://stripe.com/docs/testing

Posted on behalf of the question asker

Problem

I would like to test invoice.payment_failed event with VCR Pseudocode: - create a customer with invalid card - create an invoice with invoice item (here the invoice gets automatically paid) - fetch the invoice.payment_failed event with Stripe::Event In step 1 Stripe returns error saying I want to add an invalid card. I used "4000000000000119" card number from https://stripe.com/docs/testing Basically I want to create a scenario where the user had card that was once valid when they first purchased something/subscribed. But a year later it's no longer valid. I don't want to mock the event data and store them in yml. I fetch event directly from Stripe and record it with VCR.

Original source