duanjue2560 2015-10-14 20:26
浏览 99
已采纳

使用PHP捕获PayPal返回变量

I am using PayPal Standard HTML form, and after the user has completed the transaction he/she is taken to the return url. I want to be able to identify the user email, the order number, and other information that may be available using php. In other words, I want to use the GET method to retrieve the variables in the URL

This is a recurring payment (subscription), and below is the html code.

  <!-- Identify your business so that you can collect the payments. -->
  <input type="hidden" name="business" value="info@merchant.com">
  <input type="hidden" name="return" value="test">
  <!-- Specify a Subscribe button. -->
  <input type="hidden" name="cmd" value="_xclick-subscriptions">
  <!-- Identify the subscription. -->
  <input id="paymentName" type="hidden" name="item_name" value="test">
  <input type="hidden" name="item_number" value="1234">

  <!-- Set the terms of the regular subscription. -->
  <input type="hidden" name="currency_code" value="CAD">
  <input id="paymentPrice" type="hidden" name="a3" value="0.01">
  <input type="hidden" name="p3" value="1">

  <input type="hidden" name="t3" value="M">

  <!-- Set recurring payments until canceled. -->
  <input type="hidden" name="src" value="1">

  <!-- Display the payment button. -->
  <input type="image" name="submit" border="0" style="width:240px;   border: none; height:50px"
  src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png"
  alt="PayPal - The safer, easier way to pay online"> 
</form>
  • 写回答

1条回答 默认 最新

  • dongmei8071 2015-10-15 05:35
    关注

    As others already commented. You should use Instant Payment Notification (IPN).

    documentation

    Basically you need to set in your html form a field called "notifyurl", something like this:

    <input type="hidden" name="notifyurl"alue="http://www.example.com/ipn_listener.php">
    

    For the ipn_listener.php you have sample code here (if PHP):

    Sample code for PHP

    If you need to attach some specif information to the payment you can also use the paremeter "custom", and read it back in you ipn listener.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。