Paypal - Return url page and variables

微笑、不失礼 提交于 2019-12-12 10:30:07

问题


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

回答1:


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">



回答2:


Wait for the IPN notification to come in, and look at the payment_status in that.
Because transactions are automatically screened for fraud, and can be funded by bank accounts, being returned to your return URL does not always equate a successful transaction.

For a list of IPN variables you can expect, see PayPal IPN and PDT variables
You'll want to look (at least) at the following values:

  • payment_status
  • mc_gross and/or payment_gross (payment_gross is used if the transaction is in USD, mc_gross if it's any other currency)
  • payment_type
  • pending_reason



回答3:


This kind of problems does exist in FF if you wait for 10 s. My solution is change the return url to "xxx.com?orderId=xxx". Then you judge if it's a POST or GET. and select your order information by orderId You don't need to worry about the status of payment. because it's should be always successful if it's returning to your store not "cancel_return"



来源:https://stackoverflow.com/questions/9046028/paypal-return-url-page-and-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!