Webhook when trial end and billing on Shopify app?

Webhook when trial end and billing on Shopify app?

AndyHung
Shopify Partner
61 0 16

Hi there, 

I setup 14-days trial and save start_trial_date and remains_trial_day to database, but I don't know when trial ends, how can I update remain trial days = 0 in database? Please help me. Thank you.

Replies 2 (2)

ShopifyDevSup
Shopify Staff
1453 238 499

Hi @AndyHung,

 

When setting up a free trial for app billing the [AppSubscription.trialDays field] can be set, which is the number of days the start of an app's billing cycle is delayed from when it was created, such as with [the appSubscriptionCreate mutation].

 

Currently there's no webhook that will notify when an app's free trial has ended so one option is to request the [AppSubscription.createdAt] timestamp in the return from the creation of the AppSubscription and then figure out the trial end by adding the number of trial days to the createdAt time.

 

Here are some helpful related docs about working with Free Trials on apps and App Billing in general:

 

- Dev docs: [Offer free trials with the Billing API]

- Dev docs: [Billing for your App]

 

Hope you have a great day,

Jon551

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

AndyHung
Shopify Partner
61 0 16

Hi @ShopifyDevSup ,

Thank you for your response. I will check it.