How to integrate a PHP CMS with paypal so that only users who completed a payment can register and authenticate?
- by ibiza
I am currently using a PHP CMS - cmsmadesimple - in order to create a website where services will be sold.
I intend to use Paypal 'Buy Now' buttons in order to offer a few packages that will be renewable every 1-month or every 3-months and that grant access to the secure content of the website for a given period of time.
Everything is going well so far but I am somewhat at loss for the user registration process as I have a few constraints I would like to use and it would be nice to automate the process if possible.
Here are the constraints :
User should be able to register to my website and choose a password himself
Only users that paid should be able to register
Access permissions should be disabled automatically after the service period if the package is not renewed
And here is the process which I am thinking of :
User clicks 'buy' on my website
User is redirected on Paypal and completes the payment
The paypal email used to pay should be returned to my server and somehow stored
If it is a new email, user needs to register to my website (else if it is a returning customer, the deactivation flag for payment stopped should be removed to give back access)
If a user does not renew his subscription, there should be a deactivation flag automatically set to the email used in order to lock access until next payment.
Ideally, no human intervention is needed.
What is the best way to implement all this? I am a bit at loss.
I found this article that explained a few things and even has a nice code snippet, except that I'm not sure where to plug it.
Thanks all