How to preserve trial days after reinstalling a Shopify app?

Topic summary

Issue: Using Shopify’s billingConfig with trialDays (e.g., 21) resets the trial to full when a merchant uninstalls and reinstalls, creating a new active charge and enabling unlimited trials.

Proposed approach: Persist trial state in your own database. Save shop ID, status (active/inactive), start date (initial install), end date (start+21), and remaining days. On uninstall, mark inactive and compute/save remaining days. On reinstall, look up the shop; if time remains, set the new charge to that remaining trial or let them continue; if exhausted, redirect to billing. Practically, recompute remaining days on each app entry by comparing current date to initial install.

Free app: Set pricing to Free in the Shopify Partner Dashboard (App pricing settings) and omit in-app billing (billing undefined).

Clarifications: Shopify does grant a new trial on reinstall by default; enforcing a single trial requires your own persistence logic. Screenshots simply illustrate the reset behavior.

Open item: A question about how currentPeriodEnd is computed when trials exist in getCurrentSubscription was asked but not answered. The thread remains partially unresolved on that specific detail.

Summarized with AI on December 28. AI used: gpt-5.

Hi @oscprofessional ,

I also setup 14-days trial, but I don’t know when trial ends, how can I update remain trial days in database? Do you have solution for this?