How to test App Subscription payment

radishhorse
Shopify Partner
5 0 1

I am developing an app and want to test out the full app subscription flow. I am able to use the REST API to create a recurring application charge. When I navigate to the confirmation URL, I want to be able to test payment. I thought I could do so if test mode on Shopify payments is on and I use the card numbers from here but the card numbers keep getting declined. Is there any way for me to test this?

 

Also, does the Webhook for app_subscriptions/update get triggered when the store pays (i.e. the status goes from "pending" to "accepted"? I want to capture the charge ID but only after the subscription is "accepted."

 

Thanks!

Replies 3 (3)

willemk
Shopify Staff (Retired)
1 0 0

Hey Radishhorse,


I understand that you are creating a Shopify App using the "App Subscriptions" model.

Based on the "Testing your app’s billing system" documentation I found, you can send a "test": true property into the charge request to have it treat the request as a test. 

In regards to the Webhook question, that webhook triggers when the app subscription status changes. Depending on how the app subscription is set up, this may or may not correspond to the merchant paying. If you offer a 30 day trial for example, the subscription will be active while the merchant hasn't paid anything. 
I do also want to point out that the "Accepted" status has been deprecated. Apps now go directly from Pending to Active

All the best with your app!

Willem

To learn more visit the Shopify Help Center or the Community Blog.

radishhorse
Shopify Partner
5 0 1

Hi Willemk,

Thanks for your response. I have been sending "test: true" as part of the charge request. However, when I "get" the charge using the /admin/api/2023-01/recurring_application_charges/ID.json endpoint the "status" is still pending. It also says "test" is true so that part is being sent in my initial request. Even if I set a trial period in my charge request, the status is still pending. 

Not sure how to get this test charge to change status.

 

Thanks for your help!

 

Kevin-M
Shopify Staff
1 0 0

Hi Radishhorse.

 

When a recurring application charge is created the status is set to pending. The charge will transition from pending to active once a merchant accepts the charge.

To learn more visit the Shopify Help Center or the Community Blog.