views:

621

answers:

4

Hi guys - this is a follow up on my question on paypal integration. I'm working ona membership site for racing fans. My membership site has 3 membership levels - free, gold and premium. When a user signs up he/she can gets a free membership on the spot but has the option to upgrade to a gold membership for 4 Dollars a month or a premium membership for 10 Dollars a month.

I've gone through the paypal integration guide a few times though and have a vague understanding of how to get this to work. I think the recurring payments option would be fine enough - however I don't know how do I implement this in my system.

Like when a user decides to go for a paid account i.e. Gold or premium from basic - what should I do on both my code side and on the paypal account side - I'd really appreciate if anyone would outline what I'd have to do here.

Plus when a user decides to upgrade from lets say a Gold to a premium account - there is the issue of computing how much should be charged to upgrade his/her account eg: a user has been billed for 4 dollars and the next day opts to go for a premium account so assuming that the surplus for the rest of the month is 5 dollars and further from that all payments would be recurring 10 dollars monthly - how do I implement this?

And in case a user decides to downgrade from a premium account of 10 dollars a month to a gold account of 4 dollars a month - how do I handle the surplus which would have to be refunded for that month alone and changing the membership?

And like wise if someone wishes to cancel membership and go to having a free account - how do I refund whatever is owed and cancel the subscription.

I'm sorry if it sounds like I'm asking to be spoon fed :( I'm quite new to this and this is for a client and I would really appreciate all the help here and really have to get this working right.

Thanks again everyone - waiting for all your replies.

+1  A: 

Maybe you are better off managing subscriptions on your side. Let the customers pay every month by 'invoking' a Paypal-payment for that months subscription. I think that will solve most of your problems ;)

update: Sure there are lots of websites which provide excellent information like: http://ezinearticles.com/?PayPal---How-to-Setup-PayPal-on-Your-Website-in-Less-Than-30-Minutes&id=1704708

Ropstah
Uh I didn't get that part - initially I thought of having customers pay up in lumsum for 6 months to 1 year. However I got bogged on the issue of refunding and all :-S - I don't think the client requirements are very complex - its just that I don't know how to implement them :( - are there any tutorials to do something like this or atleast get a membership payment system up and running.
Ali
see updated anser...
Ropstah
+2  A: 

I'm fairly certain there are membership modules/add-ons/extensions/etc for various content management systems and community, err.. management systems that add this very functionality.

If you're basing this on a prefab solution like Wordpress, just google for Wordpress paid membership and you'll find various plug-ins that do 90% of the work for you.

I should add that considering these are almost always for commercial use, you'll likely have to pay for the best result.

Oli
Wow! Never thought about that - are there any such plugins or classes which are not specific to any software like wordpress or jhoomla which I can integrate on my own.
Ali
I doubt it as their main purpose is to hook into a user authentication system (that would come with a known CMS). If you have already built the membership system you just need to integrate paypal. They have documentation on their site.
Oli
As for refunding the difference if a user downgrades/upgrades, I'd be prepared to do a lot of that manually because if you are a total noob, you could make very costly errors.
Oli
+2  A: 

You need to start reading up on Instant Payment Notification (IPN). This is basically just a callback from PayPal to your site, when some kind of transaction has occurred.

What you need is a php-script on your site, which you register in your paypal account. PayPal will invoke this script with information and you send information back to PayPal to let them know if the transaction is ok nor not. While doing this you have all sorts of ways to intercept what has happened.

If the customer bought product X, where X in your case can be a "gold membership" you can check against your database (assuming you have some php/mysql or similar setup) if this particular customer already had product Y you should refund blabla. That logic is completely up to you. Since it's a php script you have access to anything that php gives you access too, reading/writing from/to databases, files, mail etc.

There are also various packages that have support for this IPN. I believe ColdFusion is one of them.

Cheers !

Edit:

Good advice - however considering the situation I have I would like to know what is the easiest and most hassle free method to follow i.e. should I go with recurring billing or have the customer pay periodically. I'm open to all options and better yet any code samples that I can use straight on :)

I'd personally go for the method the customer finds the easiest way. Using recurring billing is for love and match making sites, that want to exploit on your deepest feelings as a human being. "When the customer forgets about his account we can bill him an extra period" (sitting in a wheel chair in his evil den, laughing out loud muahahaha and pats his white cat).

Here's a quick php skeleton that you can use as IPN receiver.

Edit2

Ok so recurring billing isn't such a good idea then :-S - I mean with recurring billing I don't think we would be able to maintain on our website a history of when teh customer has been billing is it?

Sure you could keep a history of this. You know when the customer first started paying and you could keep track internally whenever the customer should be invoiced/billed again. It's just a periodic check versus the first payment date.

Edit3

So in this case I would do best to go with my older idea of allowing the customer to pay in advance for 3,6,12 months and run a check when the time is near to get him/ her to renew. Cool - so in that case I won't be using paypals recurring subscription service but their Buy Now button thingy or sorta :-S are there any free books on how to do this? I seem to have a bad habit of overcomplicating things.

Yup. Buy now buttons are very nice to use together with IPN. I think you can have different IPN handlers (e.g. different php pages) for different buttons. Free books? As in those old things made out of paper? ;) There are a lot of information on the web. PayPal has tutorials on how to get started. PayPal also has a "sandbox" site, where you can create test buttons that produce fake transactions against your site. You will need to use this.

Edit4

Thanks a lot man for the great advice - figures the simpler I keep it the less issues I'd run into. Would holler again on SO should I need more advice. I had worked once a while back in 2Checkout but that was on code already built so I had a vague idea of what was going on - this is my first project using paypal though - ah well never too late to learn :)

One final thingie. Make sure that you from the beginning setup basic logging abilities, so you can dump data to file and see what's going on, what kind of data PayPal is sending to you. This has helped me tremendously. It doesn't have to be anything advanced, just a simple text file will do fine. Otherwise it can be real pain to "debug" these transactions. "FTW is going on now?" :)

Good luck !

Magnus Skog
Good advice - however considering the situation I have I would like to know what is the easiest and most hassle free method to follow i.e. should I go with recurring billing or have the customer pay periodically. I'm open to all options and better yet any code samples that I can use straight on :)
Ali
Ok so recurring billing isn't such a good idea then :-S - I mean with recurring billing I don't think we would be able to maintain on our website a history of when teh customer has been billing is it?
Ali
So in this case I would do best to go with my older idea of allowing the customer to pay in advance for 3,6,12 months and run a check when the time is near to get him/ her to renew. Cool - so in that case I won't be using paypals recurring subscription service but their Buy Now button thingy or sorta :-S are there any free books on how to do this? I seem to have a bad habit of overcomplicating things.
Ali
Thanks a lot man for the great advice - figures the simpler I keep it the less issues I'd run into. Would holler again on SO should I need more advice. I had worked once a while back in 2Checkout but that was on code already built so I had a vague idea of what was going on - this is my first project using paypal though - ah well never too late to learn :)
Ali
+1  A: 

Ali, If you are new to these types of things, definitely go with a CMS and module. Drupal is the best platform for membership sites these days, and I made a module which integrates a Paypal Subscription system. Check it out and see if it has what you need: http://www.moneyscripts.net/drupal-paypal-subscriptions (Screenshots included)

Thanks man - would definitely give it a look
Ali