How can I test a failed invoice payment?

We recommend using the card number 4000 0000 0000 0341 to create a customer object. Since the card will be declined on any payment, we then recommend subscribing the customer to a plan with a short (ie. 1-2 minute) trial period by setting the trial_end parameter.

When the trial period ends, we’ll then create an invoice for the customer’s first billing period. Upon attempting to pay that invoice, the card will be declined and an invoice.payment_failed event will be generated along with the respective charge.failed event.

Was this answer helpful? Yes / No