PageRenderTime 25ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/web/weiphp/Addons/AliPlay/Play/danbao/alipayapi.php

https://github.com/allengaller/a4c-wuma-sns
PHP | 117 lines | 57 code | 5 blank | 55 comment | 0 complexity | bd6530505145ac49af11b0bb7c7a76c6 MD5 | raw file
Possible License(s): WTFPL, LGPL-2.1, Apache-2.0, MPL-2.0-no-copyleft-exception
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>支付宝纯担保交易接口接口</title>
  6. </head>
  7. <?php
  8. /* *
  9. * 功能:纯担保交易接口接入页
  10. * 版本:3.3
  11. * 修改日期:2012-07-23
  12. * 说明:
  13. * 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
  14. * 该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
  15. *************************注意*************************
  16. * 如果您在接口集成过程中遇到问题,可以按照下面的途径来解决
  17. * 1、商户服务中心(https://b.alipay.com/support/helperApply.htm?action=consultationApply),提交申请集成协助,我们会有专业的技术工程师主动联系您协助解决
  18. * 2、商户帮助中心(http://help.alipay.com/support/232511-16307/0-16307.htm?sh=Y&info_type=9)
  19. * 3、支付宝论坛(http://club.alipay.com/read-htm-tid-8681712.html)
  20. * 如果不想使用扩展功能请把扩展功能参数赋空值。
  21. */
  22. require_once("lib/aliplay.php");
  23. require_once("alipay.config.php");
  24. require_once("lib/alipay_submit.class.php");
  25. /**************************请求参数**************************/
  26. //print_r($_POST);die;
  27. //支付类型
  28. $payment_type = "1";
  29. //必填,不能修改
  30. //服务器异步通知页面路径
  31. $notify_url = $notify_url;
  32. //需http://格式的完整路径,不能加?id=123这类自定义参数
  33. //页面跳转同步通知页面路径
  34. $return_url = $return_url;
  35. //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
  36. //卖家支付宝帐户
  37. $seller_email =$seller_email;
  38. //必填
  39. //商户订单号
  40. $out_trade_no = $_POST['out_trade_no'];
  41. //商户网站订单系统中唯一订单号,必填
  42. //订单名称
  43. $subject = $_POST['subject'];
  44. //必填
  45. //付款金额
  46. $price = $_POST['price'];
  47. //必填
  48. //商品数量
  49. $quantity = "1";
  50. //必填,建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品
  51. //物流费用
  52. $logistics_fee = $_POST['logistics_fee'];
  53. //必填,即运费
  54. //物流类型
  55. $logistics_type = $_POST['logistics_type'];
  56. //必填,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
  57. //物流支付方式
  58. $logistics_payment = $_POST['logistics_payment'];
  59. //必填,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
  60. //订单描述
  61. $body = $_POST['body'];
  62. //商品展示地址
  63. $show_url = $_POST['show_url'];
  64. //需以http://开头的完整路径,如:http://www.xxx.com/myorder.html
  65. //收货人姓名
  66. $receive_name = $_POST['receive_name'];
  67. //如:张三
  68. //收货人地址
  69. $receive_address = $_POST['receive_address'];
  70. //如:XX省XXX市XXX区XXX路XXX小区XXX栋XXX单元XXX号
  71. //收货人邮编
  72. $receive_zip = $_POST['receive_zip'];
  73. //如:123456
  74. //收货人电话号码
  75. $receive_phone = $_POST['receive_phone'];
  76. //如:0571-88158090
  77. //收货人手机号码
  78. $receive_mobile = $_POST['receive_mobile'];
  79. //如:13312341234
  80. /************************************************************/
  81. //构造要请求的参数数组,无需改动
  82. $parameter = array(
  83. "service" => "create_partner_trade_by_buyer",
  84. "partner" => trim($alipay_config['partner']),
  85. "payment_type" => $payment_type,
  86. "notify_url" => $notify_url,
  87. "return_url" => $return_url,
  88. "seller_email" => $seller_email,
  89. "out_trade_no" => $out_trade_no,
  90. "subject" => $subject,
  91. "price" => $price,
  92. "quantity" => $quantity,
  93. "logistics_fee" => $logistics_fee,
  94. "logistics_type" => $logistics_type,
  95. "logistics_payment" => $logistics_payment,
  96. "body" => $body,
  97. "show_url" => $show_url,
  98. "receive_name" => $receive_name,
  99. "receive_address" => $receive_address,
  100. "receive_zip" => $receive_zip,
  101. "receive_phone" => $receive_phone,
  102. "receive_mobile" => $receive_mobile,
  103. "_input_charset" => trim(strtolower($alipay_config['input_charset']))
  104. );
  105. //建立请求
  106. $alipaySubmit = new AlipaySubmit($alipay_config);
  107. $html_text = $alipaySubmit->buildRequestForm($parameter,"get", "确认");
  108. echo $html_text;
  109. ?>
  110. </body>
  111. </html>