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.

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

报告相同问题?

悬赏问题

  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名