Mobile app version of vmapp.org
Login or Join
Mendez628

: Paypal PDT and IPN , how does it work? 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

@Mendez628

Posted in: #Integration #Paypal #Transfer

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 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 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. ykyuen.wordpress.com/2010/02/17/paypal-payment-data-transfer-sample-code/

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Mendez628

1 Comments

Sorted by latest first Latest Oldest Best

 

@Welton855

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme