I am creating a website, where I will sell computer and calculator programs. When the "buy" button is pressed. I would like the user to be directed to Paypal (whether they stay on the website or not). After they pay, the user would be brought back to my website, and the program would automatically download.

How can i do this to ensure:
  • The user correctly pays for the program through Paypal
  • The correct program that they paid for downloads after
  • There is no direct link to the program so that the user could then download it many times without paying.
Thank you very much in advance!

4down voteaccepted
Paypal PDT (redirecting after payment) and IPN (behind the scenes) is exactly what you are after.

Payment Data Transfer (PDT) provides merchants with the ability to display transaction details to buyers who are redirected back to their site upon payment completion.

Note: You must enable Auto Return to use Payment Data Transfer. For more information on Auto Return, please refer to the Auto Return manual which is available on the PayPal website.

Auto Return Overview

With Auto Return for Website Payments, your buyers are redirected back to your site immediately after clicking the Pay button on the Payment Confirmation page.
Auto Return applies to all PayPal Website Payments, including Buy Now, Donations, Subscriptions, and Shopping Cart.
Your buyers enjoy a streamlined checkout experience and are returned back to your site quickly!

How Auto Return Works

Setting Up Auto Return

To set up Auto Return:
  1. Log in and click the Profile subtab under My Account.
  2. Click the Website Payment Preferences link under Selling Preferences.
  3. Click the On radio button to enable Auto Return.
  4. Enter the Return URL. Note: You must meet the Return URL requirements in order to set up Auto Return. Learn more about Return URL.
For more information about Auto Return, please refer to the Auto Return section of the Website Payments Standard Integration Guide
Note: If you are using or planning to use Auto Return, you cannot use Subscription Password Management. Likewise, if you are using or planning to use Subscription Password Management, you cannot use Auto Return.

Return URL Requirements

The following items are required to set up Auto Return.

Per the user agreement, you must provide verbiage on the page displayed by the Return URL that will help the buyer understand that the payment has been made and that the transaction has been completed.

You must provide verbiage on the page displayed by the Return URL that explains that payment transaction details will be emailed to the buyer.

Example: Thank you for your payment. Your transaction has been completed, and a receipt for your purchase has been emailed to you. You may log into your account at www.paypal.com to view details of this transaction.

Here is sample code for the script to get you started instantly:
Some additional Tips for security: Verify amount, currency and product-id with your database's data to make the download available. Open a paypal sandbox account.
To don't reveal the download location: Use the order-id verified by pdt as a unique download-identifier. You have to use a script like this: redirect the user in the pdt-script here or include it in pdt if payment verrified:
$orderid = $_GET['orderid'];
$productid = $_GET['productid'];
$time = $_GET['time_from_paypal']; // when the purchase was made
$fn = "files/".$productid.".mp3";
($time =here your conditional)?$do==true:$do==false;
if ($do==true){
header('Content-Disposition: attachment; filename=' . basename($fn));
} else {.....
the part "here your conditional" can be anything. you could restrict them to download within the following x seconds after the payment was made. usually the processing from paypal takes a maximum of 20 seconds. so if you want the download to be made only once check if the payment_time and the actual time divergent less than 30 seconds. because of the redirect the user gets the download instantly after payment is veriffied. wrote but not tested


0 nhận xét Blogger 0 Facebook

Post a Comment

Cám ơn bạn đã phản hồi

Subscribe to: Posts (Atom)

Sang kien kinh nghiem HAY - NCKHSPUD HAY - Sangkienkinhnghiemhay.net ©Email: tailieuchogiaovien@gmail.com. All Rights Reserved. Powered by >How to best
Link:Bantintuvan|tailieusupham|khoahocsupham|Soidiemchontruong|inluon|Tài liệu|Hoctrenmobile|SKKN|Tử vi|Science