简体   繁体   中英

How to get webhook notification when subscription's payed through date has passed

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:)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM