Tutorial Details
- Program: PHP
- Version: >=5
- Difficulty: Intermediate
- Estimated Completion Time: 1 - 2 hours
Download Source Files
In today’s tutorial, you’ll learn how to create a small web app to sell digital items (eg. eBooks) securely and accept payments from PayPal. Become a Premium member to read this tutorial, as well as hundreds of other advanced tutorials and screencasts.

Join Net Premium
For those unfamiliar, the family of Tuts+ sites runs a premium membership service. For $19 per month, you gain access to exclusive premium tutorials, screencasts, and freebies from Nettuts+, Psdtuts+, Aetuts+, Audiotuts+, Vectortuts+, and CgTuts+ For the price of a pizza, you’ll learn from some of the best minds in the business. Become a Premium member to read this tutorial, as well as hundreds of other advanced tutorials and screencasts.
Other Awesome Premium Tuts you may Like
- Venturing into Vim: Premium Video Series
- How to Build the Trendy new jQuery Sliders
- CSS: Noob to Ninja
- How to Build a Beautiful Calendar Widget









I’m badly in need of a mooneybookers php class for CodeIgniter as some countries do not allow transaction via PayPal.
Thanks.
not some, many!
Hello, just a question: Will this tutorial use paypal IPN (Instant Payment Notification)? If so, I’ll probably buy Premium for this.
Yes it does :)
Damn!
My premium account just expired las week :(
I can’t login the premium membership.
Awesome! I’m looking forward to going through this later on. And just to clearify…this is completely secure to use in the real world right now? and should work just fine with selling, for example, psd files?
“Completely secure” is kind of relative isn’t it?
I’d trust a CodeIgniter package with XSS filtering and prepared statements to handle an e-marketplace.
Can I purchase this Tutorial in the Marketplace?
Henry – It’s just a matter of when Dan uploads it there. :)
Looking forward to purchase it Dan!
:D
looking forward to buy it too :)
I’ll be uploading it in a few days as I’m away right now.
Looks like a great tut. I am looking forward to picking this up on the tutorials marketplace when it is made available.
Simple enough to sell digital goods.
Thanks for sharing.
Meh people should really get away from Paypal and Moneybookers … it’s hardly ever used in some countries, seriously how hard is it to setup creditcard payments :P?
Paypal / Moneybookers is the only reason I don’t have a nettuts plus account … i just prefer to pay via creditcard.
Login isn’t working so I can’t see the files.
Interesting article – I struggled through CodeIgniter over a year ago trying to do just this. Well not just this actually more detailed. But either way I would have killed to read this tut way back then…..
In this tutorial the author creates a library or just set up everything in the controller?
Gotta love Pul.ly eh.
Cool man!
Great tutorial, I think I will buy it from the markeplace, as I am only interested in this one. I hope it covers IPN
I am a premium member and I can not download the source files.
Wow what a super cool app.
I’ve totally changed my perception of Codeigniter and frameworks as a hole. Not just based on this tut, not on the fact that Codeigniter makes doing things a lot faster and certainly more fun!
Can I ask, when the user gets sent the item – do they get given a unique url to download the item?
Yes, they’re emailed a download URL unique to them. As an ‘extra’ section at the end of the tutorial, we use the unique URL to allow download restrictions (eg. up to 4 times every 7 days).
i am also a member and cannot view the source files
+1 that would buy the item if uploaded to the marketplace :)
Thanks, tutorials like this are the reason I joined Tutsplus Premium. Looking forward to see more like this!
I bought it on the Marketplace, a very well done tutorial, with commented code and working example! :)
I hope nettuts will come up more tutorials like these, nobody really covers a tutorial which will use Paypal
same question with Sebastian , does it cover IPN?
Yep, it uses IPN.
Stefano where did you find this on the Marketplace can you supply a URL as I’m interested in buying this one.
TIA
Oh how foolish I feel now I’ve scrolled to the top of the page and seen:
Not Premium? This tutorial is available on the Tuts+ Marketplace
:-)
rather paying $5 one month subscription is $9 go for that
Can we see a real life example using this code?
If you need any help related to PAYPAL Pro using code igniter, you can write me back and I will send you the library I’ve created for codeigniter.
Hi Dan Harper
Very good tutorial, not for beginners, but defenitly easy to understand.
I just dont get:
Why do you not check if the customer actully paid the price you set?
The customer can change it to just pay 1 cent, and he would get the product, because nothing checks it.
You should change the hash to be without the time, and then when you get the data back from Paypal, make a new hash and compare them each other, then you will be sure!
Maybe i should make my own tutorial explaining that!? :P
Kevin Simper
Hey, awesome tutorial, very useful. I adapted some of this code in an app I’m working on, and I just wanted to point out a small mistake, not sure if anyone caught it yet.
In testing I found that in my order records, the Paypal transaction ID wouldn’t end up in the database, it’d just be null. I eventually figured out why–in your confirm_payment() function, the parameter for that is called $payment_txn_id, but within the function, it looks for $paypal_txn_id… not quite the same variable name ;) so the value never reached the database.