I'm trying to perform a payment in 3 classic steps:
1) Order Page with PayNow Button
2) PayPal Payment
3) Redirect to "Payment completed page"
What I want to achieve is to have an ID going from step 1 to step 3. What I tried to do is to insert this field into the "custom" variable like:
<input type="hidden" name="custom" value="--Server Code--">
After the PayPal payment, PayPal redirect me to my page:
http://www.mysite.cm/tx=blalba?aaaa
In this URL there is not custom Field. If, from API, I contact PayPal to have the sale details, I get nothing related to my custom Field.
What I'm doing wrong? I'm thinking of a work around using cookies but I prefer to do it in the standard way.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="return" value="testestest">
<input type="image" src="https://www.paypalobjects.com/it_IT/IT/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal è il metodo rapido e sicuro per pagare e farsi pagare online.">
<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
</form>
The PayPal Custom variable is returned in the IPN (Instante payment notification), not when the user is returned to your website after completed the payment.
In your case just a session variable would be enough.
EDIT:
Another way might be adding in the "return" field the proper url value. example:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="return" value="http://www.website.com?pram=value">
<input type="hidden" name="cancel" value="http://www.website.com?param=value">
<input type="hidden" name="business" value="yourpaypal@email.com">
<input type="hidden" name="item_name" value="Test">
<input type="hidden" name="amount" value="9.00">
<input type="hidden" name="currency_code" value="EUR">
<input type="image" src="https://www.paypalobjects.com/it_IT/IT/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal è il metodo rapido e sicuro per pagare e farsi pagare online.">
<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
</form>