Paypal - Return url page and variables

user867241 picture user867241 · Jan 28, 2012 · Viewed 46.7k times · Source

Is it possible for me to get paypal post variables in return url. I want to show a response message in return url page depending on whether the user's transaction was completed/pending/failed one. I am testing with paypal sandbox account.

Here is my code,

<input type="hidden" name="item_name" value="Credit Purchase">    
<input type="hidden" name="business" value="<?php echo paypal_business_id;?>">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="currency_code" id="currency_code" value="GBP">
<input type="hidden" name="custom" id="custom" value="<?php echo $user."@@@".$num_purchase;?>">  
<input type="hidden" name="return" value="<?php echo base_url(); ?>buy/success">
<input type="hidden" name="cancel_return" value="<?php echo base_url(); ?>"> 
 <input type="hidden" name="notify_url" value="<?php echo base_url(); ?>buy/notify

Answer

Aristos picture Aristos · Jan 28, 2012

Its possible to add on return variable, the order id, then you get your order id when the user return and from the order id you show him the informations.

Eg

<input type="hidden" name="return" value="myReturnUrl.php?OrderID=88273882717A72734">