How to simulate a failed billing attempt?

Brian_S
Shopify Partner
153 19 39

Hi - I'm working webhook handlers for a Shopify app that will leverage the new Subscriptions APIs. I would like to run a production env test of a failed billing attempt (to trigger the `subscription_billing_attempts/failure` webhook) but I can't seem to configure a scenario where that happens. 

In order to test this out, I created a subscription contract buy purchasing a subscription product on my dev store with a valid card. Then I triggered a payment method update email, clicked the link in the email and tried updating the card to one that would trigger a failed billing attempt. I've read through the test mode docs and tried the following: 

  • 4242424242424241 (incorrect number) but when I do this I'm unable to save the changes to the card bc I immediately get an error on the update page ("Failed to update your payment details. Please try again")
  • 4000000000000002 (card declined) same thing happens as with the incorrect number card
  • The invalid month, year, expiry do the same thing as expected
  • 4000000000000259 (disputed transaction) The disputed transaction card number lets me update the card number but when I attempt a new billing attempt it's successful which is what's expected for that card. (of course I get an immediate dispute but that's unrelated to what I'm testing)

 

Anybody have any recommendations on how to trigger a failed subscription billing attempt other than manually sending my webhook handler mock data? 

 

Thanks in advance for any help!

Brian Singer
CTO & Cofounder of Subscription Service - Awtomic
Replies 4 (4)

MajoMFR
Tourist
11 0 0

Hi,
I am currently facing the same scenario but I haven't got anything yet. The thing is that there is BillingAttempt event in docs but it not in events in dropdown list when we create a webhook.
If you have anything related to that kindly share.

B_A
New Member
5 0 0

I've run in to the same issue and it doesn't seem like there is much help out there. The only thing I can think of is to set the expiration date to expire in the current month and then wait for it to expire. Not very efficient given there are currently 27 days left in this month, but it's all I have.

kyle_truong
Shopify Partner
59 6 16

Just stumbled onto this thread while having the same issue too. I also saw this thread:

https://community.shopify.com/c/Subscription-APIs/There-doesn-t-seem-to-be-a-way-to-test-a-failed-tr...

that suggests it may be possible if you revoke the customer payment method?


devsmk
Shopify Partner
7 0 3

It cannot be revoked unfortunately, it results in an error. But I did leave a detailed way to make it work on that thread. Once again the link:

 

Link To Answer