Reliable way to know (and keep in sync) when a subscription will (or has) expired?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know several webhooks can be used to respond to some subscription related events, but I cannot figure out how to reliably know when a subscription will or has expire.
For instance, I thought of using the PAYMENT.SALE.COMPLETED webhook with its resource.create_time property, then add i.e. 1 month and 5 minutes, and use the resulting datetime as the moment the user will lose their subscription (until they pay again, which would trigger that webhook again and refresh the expiry date), but: if they pay late or early, then that doesn't work. Additionally, that won't work for a free month (i.e. a promotion, trial, a custom deal or whatever).
I thought of using BILLING.SUBSCRIPTION.ACTIVATED and BILLING.SUBSCRIPTION.RE-ACTIVATED to set the expiry date (within my db) to i.e. 2199.01.1, and then BILLING.SUBSCRIPTION.CANCELLED and BILLING.SUBSCRIPTION.SUSPENDED to set the expiry date to now, but then let's say they cancel or suspend their subscription in the middle of their month, then they'd lose 2 weeks where they should still have access to all the features that are given to subscribed users.
So, what's a reliable way to get (and keep in sync) when a subscription will expire?
Edit: I thought of using /v1/billing/subscriptions/{id} to get next_billing_time whenever my user logs in and assume that next_billing_time corresponds to the moment the subscription will expire, but again, does that field actually coincide with the time the user will not be subscribed if they don't re-pay?

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Subscription renewal alerts and failures in REST APIs
- When does my subscription enter one of these states? in Sandbox Environment
- Is it possible to reactivate my subscription if it's in one of the following states? in Sandbox Environment
- Subscriptions API is highly inconsistent in REST APIs
- All subscriptions that are created appear with the status: EXPIRED in Sandbox Environment