sikwondo — 2011-04-05T05:22:23-04:00 — #1
I'm not sure if this is the correct place to post this, please let me know if so, but I am well and truly stuck.
I need to set up payments through PayPal, that will take the user from the site to PayPal to pay, then, once paid, redirect back to the site to then download the purchased file.
Is this doable via PayPal? Been through their docs and can't work it out.
Also, is it possible to encrypt the download link to protect it being shared?
Sorry if this is the wrong place.
many thanks for any help in advance
ralphm — 2011-04-05T05:27:10-04:00 — #2
This is certainly doable. I wanted to do this a while back, and after scouting around various solutions, I settled on Linklok, which is a great little bit of software. You install a vary simple script on your server that interacts with PayPal. After payment, the customer is redirected to a page on your site with an encrypted link to the download file. The link is generated on purchase, so the real location of the file can't be determined. You can set the link to expire any time.
It's a really nice little solution, and a small, one-off payment. It was even easy for a noob like me to set up.
[PS: I've moved this thread to the PHP forum to Ecommerce.]
anthonysterling — 2011-04-05T05:31:46-04:00 — #3
Sure, you can use PayPal's IPN service to permit the download once payment has been confirmed.
- Create a database record, indicating purchased file, hashing users IP and browser agent, add a cookie too
- Send to PayPal for payment
- Provide user a unique URL for this download
- Once payment has been confirmed, enable download in database for set period of time
That's usually the, very rough, gist of it.
Get the download where the browser and ip is the
same as the user who paid, and has the cookie value,
and is paid for, and where the number of downloads
is less than or equal to 2.
$sql = sprintf(
paid = 1
ua = '%s'
ip = '%s'
hash = '%s'
downloads <= 2;",
asher — 2011-04-05T07:13:43-04:00 — #4
The following class can help you setting up quickly
paypal_ipn (paypal IPN) - PHP Classes
technowonder — 2011-04-05T12:38:07-04:00 — #5
If you don't want to have to write and manage the code for this yourself, you can use a pre-built off the shelf solution for your digital download store which works with your PayPal account to take the payments but handles the secure delivery of the files to your customer. I have used this 3rd party digital download service before and it is a real time saver and means you avoid ongoing support for your own cobbled together code: Sell Digital Downloads
sikwondo — 2011-04-05T15:09:13-04:00 — #6
Thanks a lot for your help everyone, really appreciate it.
I am going to give Ralph's solution a try - have purchased and working through the setup now