Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
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.
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