Running subscriptions in PHP, talking to PayPal

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Running subscriptions in PHP, talking to PayPal

Post by simonmlewis »

We are building a subscription only web site and want to use either PayPal or Google Checkout for the subscriptions.

They will be the automated subs, but we need a way for our loginscript to talk to PayPal via Javascript or something, to see if the user's email address, and our ShopID has paid their subscription.

So someone pays via shopID 12345, using bob@bobby.com.
When they login, it queries their email and pass against our DB. If it finds the data, it then queries with PayPal/Google to see if they are paid.

THAT'S THE PART WE ARE STUCK ON.

There is something in PayPal you can use, but the user must create their username and pass on PayPal - and PayPal actually generate it, which to me is rather counter-productive.

Does anyone know a genius way to do it??

Thanks.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Running subscriptions in PHP, talking to PayPal

Post by Christopher »

When they pay with PayPal, it will return the success or failure. If payment is successful then you would add a record to a "subscriptions" table in your database with their user ID and the date their subscription expires (plus any other information, such as what they subscribed to). Then when they successfully login with their email address you can lookup the status of their account.
(#10850)
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Running subscriptions in PHP, talking to PayPal

Post by simonmlewis »

If they are paying by subscription, and it's an automatic subscription (they don't manually do it each month), how will my system know they are all paid up?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Running subscriptions in PHP, talking to PayPal

Post by Christopher »

If it is an automatic subscription, then you will need to bill their credit card on a regular basis. You would update their subscription record each time to automatically re-subscribe them.
(#10850)
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Running subscriptions in PHP, talking to PayPal

Post by simonmlewis »

But it's done automatically through PayPal - it doesn't touch our system as PayPal would bill them.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply