Hey @VIVEK_KUMAR_BAJPAI - need to correct my earlier response, my bad. Short answer is you can’t reactivate a cancelled subscription. When the app is uninstalled, the subscription is cancelled automatically, and there’s no way to “resume” it. You have to create a new one.
The issue with my APPLY_ON_NEXT_BILLING_CYCLE suggestion is that it only defers against an active subscription. Once cancelled (which happens on uninstall), there’s nothing to defer to - so the new subscription just starts its own fresh 30-day cycle from approval.
To handle this fairly for the merchant, you’d need to:
-
Calculate how many days remained on the original subscription (e.g., original
createdAt+ 30 days = original period end, then work out days remaining from reinstall date) -
Pass that as
trialDaysin your appSubscriptionCreate call
One catch is that currentPeriodEnd returns null once a subscription is cancelled, so you can’t query it after the fact. You’d need to either calculate from createdAt + billing interval, or store the value proactively while the subscription is still active.
Using your example, if they subscribed Jan 1, uninstalled Jan 15, reinstalled Jan 20 - the original period would end Jan 31. That’s 11 days remaining, so you’d create the new subscription with trialDays: 11.
Apologies for the confusion in my first response - this edge case has come up before and the replacementBehavior options don’t help in uninstall/reinstall scenarios.