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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?