Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

PDT

Payment Data Transfer is getting the transaction data of the purchase that was made on paypal site and you want to fetch that on your own site and display to the user. Also you may want to store it in your database for archive and tracking purposes. But I cannot exactly follow the documentation here

What I am not getting is

Once you have activated PDT, every time a buyer makes a website payment and is redirected to your return URL, a transaction token will be passed along as a "GET" variable to this return URL. In order to properly use PDT and display transaction details to your customer, you should fetch the transaction token, variable name "tx", and retreive transaction details from PayPal by constructing an HTTP POST to PayPal.

Your POST should be sent to https://www.paypal.com/cgi-bin/webscr. You must post the transaction token using the variable "tx" and the value of the transaction token previously received (e.g. "tx=transaction_token"), and the special identity token using the variable at and the value of your PDT identity token (e.g. "at=identity_token"). You will also need to append a variable named "cmd" with the value "_notify-synch", for example "cmd=_notify-synch", to the POST string.

IPN

I have setup Instant Payment Notification through setting according to this documentation. This is basically logging into your paypal account and enable IPN while specifying a url where the notification will be sent. This is used to complete an order so that the product can be shipped. What I did is setup a PHP page. I have created a table and whenever that page is called (or hit), it registers an entry in the table so I know a notification came from Paypal. But it does not work either.

What am I really doing wrong? The first thing I want to trouble shoot though is when the buyer pays the amount, he is automatically redirected to my site. I have enabled this but automatic redirection just does not work. Instead he is shown the url as an option after payment confirmation is shown.

Can someone guide my how the PDT process goes? Where do I make the request for PDT, is it along the very first request (Buy Now button) or it is sent later?

Addition

I found some good sampling code of how everything should work but it still does not work. I use this code http://officetrio.com/modules/free-php-paypal-ipn-script.php for IPN. I am using this for PDT. This one uses SSL, I changed SSL to regular HTTP (copied paypal version), still does not work. http://ykyuen.wordpress.com/2010/02/17/paypal-payment-data-transfer-sample-code/

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

When I integrate PayPal I only use the PDT transaction token on the return URL to let the user view the status of the payment. So when the user returns from PayPal the website is issuing a POST request (server side) to the PayPal server and the current status is retrieved. This information is displayed to the user along with any order details. If it failed the user is given a choice to try again or choose a different payment option. If it succeeded no further action is needed.

I only update the actual payment status of the order upon receiving an IPN update from PayPal. This IPN update results again in a POST request to the PayPal server and the status received then will be used to update the payment status.

Are you testing using the PayPal Sandbox environment? To be honest, it's a pain in the *** to use and quite confusing at times as you have to login multiple times with different accounts and account types to finally simulate a payment. You can turn on auto return under Selling Preferences -> Website Payment Preferences and then enable Auto Return, enable Payment Data Transfer and provide a Return URL. You don't have to add the tx querystring variable as PayPal will automatically add that.

You can turn on IPN under Selling Preferences -> Instant Payment Notification Preferences) and provide the Notitication URL that PayPal must use. PayPal will issue a GET request to this URL whenever there's an update concerning a payment.

share|improve this answer
    
I did all that and got some really useful link to implement everything but the auto return does not work. Can you tell me how exactly it works? Is there an intermediate paypal page showering confirmation and then redirects or it is just direct redact. Do paypal have to approve you page to make it active? I am actually using production environment because I can refund the transaction with minor fee. –  slow diver Nov 5 '11 at 18:11
1  
After the payment it shows an intermediate screen that automatically redirect back to the website after 10 seconds (or if the user clicks on the link manually). This the last screen I see from PayPal on one of my test sites, using the Sandbox environment. As far as I know PayPal does not have to approve your return URL. –  Marco Miltenburg Nov 7 '11 at 8:41
    
This helps. This happened to me one time and I was not sure if this is the standard way of redirect. It didn't happen gain though. I was thinking more of a direct redirect without intermediate screen. Thanks –  slow diver Nov 7 '11 at 12:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.