I am looking for best practice concerning user subscription handling.
The user can subscribe through paypal (handled with paypal IPN) to obtain a status that give them some priviledge on the website.
However the subscriptions are for one year.
What are best practices to automatically detect when a subscription should be cancelled (one year after subscription is done)?
Thank you.
I am looking for best practice concerning user subscription handling. The user can subscribe
Share
With use of a database, you could store the expiry date of the subscription as a DateTime of the current time + 1 year.
You could then either have a script run routinely or check on log in, if the current time is greater than the subscription expiry time. If it is, change the user’s account to unsubscribed.
In PHP:
That will tell you the Day/Month/Year of a year from today, so you could store that in the user/subscription table. On log-in, you can then just compare that against:
If $today is larger than the stored value for the expiry date, then you know to cancel the subscription and/or prompt them to pay for the next year.