PayPal Payments

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
kinger88
Forum Newbie
Posts: 12
Joined: Thu Apr 09, 2009 10:08 am

PayPal Payments

Post by kinger88 »

Hi all,

Just wondering if anyone on here uses PayPal on their websites?

I want to build an MP3 store which accepts PayPal as the payment option and then once the user has paid I want them to be redirected back to my site where the order will get marked as paid some how and download links will be shown.

Is this something I can achieve if I use PayPal?

Cheers
Steve
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: PayPal Payments

Post by Eric! »

Yes you can do it, but it is a lot of work for someone new to php. And I recommend you setup a login/download system for paid users rather than just passing them on to a link. It's more secure and easier to manage in the long run and you don't have to worry about hotlink theft.

Here's a typical flow:
1. Create paypal buttons that allow IPN http://www.micahcarrick.com/04-19-2005/ ... class.html
2. Process the orders into a database. (temp user name/id, items purchacased, email address,etc.)
3. Email notification of payment received and temp username and password and a link to your login page.
4. User logs in (sessions are started) and the user is presented with a list of items they've purchased for download.
5. A php download script serves up the files that they click on (don't rely on just providing a link).
6. User logs out or session expires.

Then you have the 10,000 other things you have to deal with. Lost passwords, old email addresses received from paypal, providing detailed and clear instructions for users, passwords that are made public, excessive downloading on certain accounts, managing user info, security (database, email, xss), making the database and site scalable as item increase and user base grows, throttling the bandwidth of heavy downloaders, etc.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PayPal Payments

Post by califdon »

I agree with Eric!, except I would be a bit less pessimistic about the admittedly many things to be concerned with. PayPal has an active developer community and their forums at http://paypaldeveloper.com/pdn/ are very helpful. You will be able to get more and quicker responses there than in a general PHP forum like this one. PayPal has huge amounts of documentation at https://cms.paypal.com/au/cgi-bin/?cmd= ... umentation and perhaps the biggest problem is picking out exactly what you need for your operation. PayPal offers a wide range of different ways to interact with them, which can be confusing. As Eric! indicated, I found the IPN (Instant Payment Notification) method to be the most suitable for my application. But I decided to not use their shopping cart because of the complexity of my needs, so my scripts present all the available choices and send PayPal only a single transaction and billing amount.

While I may be more optimistic than Eric!, it is certainly true that integration with PayPal is not a beginner's project. It requires a full understanding of PHP and transaction processing, as well as online security.
kinger88
Forum Newbie
Posts: 12
Joined: Thu Apr 09, 2009 10:08 am

Re: PayPal Payments

Post by kinger88 »

Hi,

Thanks for the help, I have a good knowledge of PHP and have got the download scripts etc all sorted, it was just the payments I hadn't done before but i'll check out those links you have provided 8)

Thanks again
Post Reply