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 !