Reproducing the "CC denied charge" error

79 views
Skip to first unread message

Alex Wait

unread,
Jun 24, 2021, 12:40:28 PM6/24/21
to api-d...@lists.stripe.com
As we grow subfund.me into a more complete platform we're occasionally running into the many many errors & edge cases a payment processor integrated platform runs into:

The latest for us is a CC working fine but for some reason or another payment intent fails.
So far I've only seen them under the "payment_intent.payment_failed" event.

What I'm not sure is how to trigger this event for some integration test (by hand testing) using the stripe.com dashboard. Does anyone know if there is a way to repo errors like this in the dashboard?

 The bank returned the decline code `do_not_honor`

This is the first time I've not been able to easily repo a use case in the dashboard for final QA testing so I'm sure there's a way that I just haven't found yet.

Thanks!

Alex Wait
--
Buoyancy and displacement float my boat.

Remi J.

unread,
Jun 24, 2021, 12:47:04 PM6/24/21
to Stripe API Discussion
Hello Alex,

We don't have a test card specific for the `do_not_honor` decline code today. We have a few test cards for other decline codes such as `insufficient_funds` though. Overall, all decline codes behave similarly so you would handle `do_not_honor` mostly the same way as `insufficient_funds`. Your code would mostly switch on `decline_code` as needed. There are too many decline codes for us to add a test card for every single one but you could mock the API to return a specific decline code to test your code for example

I hope this helps!
Remi


--
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.

Alex Wait

unread,
Jun 26, 2021, 4:19:42 AM6/26/21
to api-d...@lists.stripe.com
Thanks Remi!
I totally forgot there was a set of test cards.

I tried using the one you suggested and got this

image.png

Which is great for certain use cases. 

What I need to properly test and account for is when the card works and pays out the first invoice but subsequent invoices are declined (for a subscription)
I need to handle this buy probably emailing the user and saying "you need to update your card my man" and then reactivate their subs.

Is this something that's supported?

Alex


Remi J.

unread,
Jun 26, 2021, 4:57:43 AM6/26/21
to Stripe API Discussion
Hello,

We have a test card explicitly for this and we cover this in more details here [1]. The idea is to add the card 4000 0000 0000 0341 to a customer which will then automatically fail the next payment. You put the Subscription on a trial period for a few minutes and wait for it to renew. When the trial ends, it starts a new period with its first invoice and it simulates the subscription renewing. You can pay the invoice via the API and you'll see it fail!

Hope this helps!
Remi



Reply all
Reply to author
Forward
0 new messages