Reputation: 75
I would like to allow my users to maintain access to the features unlocked via a subscription until the end of the payed-through period (even if the subscription has been canceled).
To do so I would need to update the user's permissions in my database, and the best way would be by receiving a webhook notification when the payed-through date has passed.
Is this possible? If not what would be the best approach to achieve this behavior?
Any help is greatly appreciated :)
Upvotes: 0
Views: 122
Reputation: 75
Solved the problem.
When the user cancels the subscription, instead of calling
await gateway.subscription.cancel(subscriptionId);
simply call
await gateway.subscription.update(subscriptionId, {
numberOfBillingCycles: 1
});
this will cause the subscription to remain active until the paidThroughDate and then expire (instead of renewing) triggering the SubscriptionExpired webhook.
Upvotes: 0