11

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 !

8 Answers 8

16

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.

5
  • 3
    I got this working on the live site but the sandbox (dev) site isn't working. Damn sandbox area doesn't always work as expected or as the live area works :@. Jan 3, 2012 at 1:16
  • @Daniel - Although I certainly agree the sandbox site is seemmingly ALWAYS messed up, having a "return" value definitely does work and is still contained in the PP documentation updated end of November 2011.
    – JM4
    Mar 6, 2012 at 23:14
  • This has never worked for me. Had to resort to testing Live to get a tx value. Definitely a bug in PayPal's sandbox!
    – MC9000
    Jan 25, 2021 at 0:49
  • I discovered that on the Sandbox site, if the user manually click to return to merchant, it doesn't include the TX value. See paypal-community.com/t5/Sandbox-Environment/… Feb 13, 2021 at 18:33
  • This url will only open when you login the sandbox with business sandbox account. In my case it is ****-facilitator@****.com. Also when you set Payment Data Transfer on, you will get an identity token. Apr 9, 2021 at 5:37
5

I've just been struggling with this for some time, and another thing that seemingly causes no tx value to be returned is if you have a free trial.

So, if the cost of your service is free for the first 20 days then 4.99 thereafter you won't get a tx value back for the first free payment. If you charge one penny (or whatever your relevant currency is) for the initial 'free' period then you will get a tx value returned.

2
  • No transactions are performed for free payments, the tx value relates to a merchant transaction being performed. $0 is normally passed successfully with no transaction performed. Aug 12, 2012 at 14:08
  • Thanks. It already a big problem... So I could not provide free trial. Amazing..bad..
    – Zagfai
    Dec 11, 2018 at 15:16
5

We actually logged a ticket with PayPal Merchant Technical Services to get to the bottom of this. We found that over time, some paypal merchant accounts would appear to forget their AutoReturn/PDT settings.

Even though you could go into the Website Preferences and AutoReturn and PDT were both enabled; the account would behave as if they were not enabled.

Follow this procedure to reset the settings ....

  • Click on Profile.
  • Click on "My Selling Preferences">
  • Click on "Website Preferences"

(*) Direct link to this section, in case you can't found it -> https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-website-payments

  • Disable both Auto Return and Payment Data Transfer.
  • Save your changes.
  • Access to Website Preferences again.
  • Enable Auto Return and Payment Data Transfer again.
  • Save your changes.
2

I've got the same problem with sandbox during testing. To fix it I had to verify test accounts in sandbox environment. To verify them use the build-in testing e-mail service. After verifying, paypal sandbox started to sent TX parameter.

4
  • That's annoying and doesn't make sense why they would do that. Jan 31, 2012 at 7:05
  • @12lanterns - how did you do this? I'm pretty familiar with sandbox but every time I create a new account, I never need to verify an email nor does it show up in the test email services
    – JM4
    Mar 6, 2012 at 23:21
  • @12lanterns - also, all preconfigured accounts automatically have this feature enabled: screencast.com/t/YHZTCBK0NR8L Not sure what else to try.
    – JM4
    Mar 6, 2012 at 23:36
  • 1
    My test accounts in sandbox were already verified. But still, tx parameter is not concatinated in my return url. Any idea? I have also set Auto return to ON.
    – Floricel
    Jul 23, 2012 at 7:51
1

A few other reasons why you might not get a tx parameter:

  • For PDT to work, you must confirm the email address used as the value of business in your button code. If this email address is not confirmed, PDT will not work. If your email address is not confirmed, you will not see the PDT query string appended to your return URL.

  • When you enable PDT, the URL you are using as the default Auto Return URL must be a valid hostname or IP address or the user will not be auto-returned back to that URL. Make sure you use a valid URL as the URL of where you want the user to go back to or you will not see the intended result.

From: https://ppmts.custhelp.com/app/answers/detail/a_id/469

1
  • There's no way to confirm emails on the Sandbox account - at least not in 2021, so that's not an answer anymore.
    – MC9000
    Jan 25, 2021 at 0:55
1

i have found a method, that worked for me - try to insert this field into your generated form code:

<input type='hidden' name='rm' value='2'>

rm means return method;

2 means post with variables

Than after the user purchases and returns to your site url, then that url gets the POST parameters as well

p.s. if using php, try to insert var_dump($_POST); in your return url(script), then make a test purchase, and when you return back to your site you will see what variables are got on your url.

0

I had a similar problem - where working from a local server, i used to get instead of the 'tx' variable, i got a 'auth' variable. After playing around with it for a while, found that (for some wired reason) if i change my vitrual host and host file, to the real domain, i get the 'tx' variable, where as in my local environment domain i get the 'auth' variable. That fixed it for me. Hope this helps anyone.

1
  • Paypal doesn't send any querystring info at all for me. I wish PayPal would fix this decade old bug!
    – MC9000
    Jan 25, 2021 at 1:03
0

I also opened a PayPal Merchant Technical Services ticket for this.

For transactions initiated by a PayPal Button. The PayPal back end sometimes loses the monetary values of the pricing structure (even though it shows you, and you can edit the pricing, the back-backend will lose the values and not accept updates).

Symptoms: In Sandbox, the PayPal process will fail after login but before it can show you the screen for choosing the funding source (i.e. which back account or credit card to use). You get the "We're sorry; Things are not working" message.

Create the Button anew and hopefully the pricing is saved this time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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