PayPal PDT is not Returning a tx value in the Query String

Dallas Clark picture Dallas Clark · Dec 21, 2011 · Viewed 9.4k times · Source

I've gone through the (not so helpful) PayPal docs and can't find an easy answer to this problem. When the user returns from PayPal, the URL does not contain a query string and thus I do not receive the 'tx' value (or any other value for that matter).

This is an example of what I'm sending to PayPal:

<form accept-charset="utf-8" action="https://www.sandbox.paypal.com/au/cgi-bin/webscr" id="paypal-form" method="post">
    <input type="hidden" name="business" value="[email protected]">
    <input type="hidden" name="cancel_return" value="http://localhost/checkout">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="charset" value="utf-8">
    <input type="hidden" name="currency_code" value="AUD">
    <input type="hidden" name="custom" value="155">
    <input type="hidden" name="lc" value="AU">
    <input type="hidden" name="notify_url" value="http://localhost/paypal-ipn">
    <input type="hidden" name="return" value="http://localhost/checkout">           
    <input type="hidden" name="item_name" value="ABC Company - Order #155">
    <input type="hidden" name="item_number" value="155">
    <input type="hidden" name="amount" value="8.95">
    <input type="hidden" name="discount_amount" value="0.00">
    <input type="hidden" name="shipping" value="25.00">
    <input type="image" src="https://www.paypal.com/en_AU/i/btn/btn_buynowCC_LG.gif" name="submit" alt="Buy Now">
</form>

Thanks in advance !

Answer

Daniel picture Daniel · Dec 29, 2011

You should check the settings at https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments and make sure

  1. Auto Return is set to ON
  2. You have specified a Return URL
  3. Payment Data Transfer is set to ON

There's another much less obvious thing I had to learn through experimentation: your form must not contain a "return" value, otherwise that will override the Return URL in your settings and prevent the Auto Return from working and you'll wind up without the necessary tx parameter. This is a relatively recent development (bug?) at Paypal, because it used to work.