to_pay.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. if(!defined('InEmpireCMS'))
  3. {
  4. exit();
  5. }
  6. eCheckCloseMods('pay');//关闭模块
  7. if($payr['paymethod']==0)//双接口
  8. {
  9. $use_service='trade_create_by_buyer';
  10. }
  11. elseif($payr['paymethod']==2)//担保接口
  12. {
  13. $use_service='create_partner_trade_by_buyer';
  14. }
  15. else//即时到帐接口
  16. {
  17. $use_service='create_direct_pay_by_user';
  18. }
  19. //------------------ 参数开始 ------------------
  20. $agent="";
  21. $service=$use_service;
  22. //商户号
  23. $partner=$payr['payuser'];
  24. //密钥
  25. $paykey=$payr['paykey'];
  26. //卖家支付宝帐户
  27. $seller_email=$payr['payemail'];
  28. //字符编码格式
  29. $_input_charset="GBK";
  30. //加密方式
  31. $sign_type="MD5";
  32. //返回地址
  33. $notify_url=$PayReturnUrlQz."e/payapi/alipay/payend.php";
  34. $return_url=$PayReturnUrlQz."e/payapi/alipay/payend.php";
  35. //支付方式
  36. $payment_type=1;
  37. //默认支付方式
  38. $paymethod="";
  39. //银行类型
  40. $defaultbank="";
  41. //物流类型
  42. $logistics_type="EXPRESS";
  43. //物流费用
  44. $logistics_fee="0";
  45. //物流支付类型
  46. $logistics_payment="BUYER_PAY";
  47. //------------------ 参数结束 ------------------
  48. if($payr['paymethod']==1)//即时到帐不需要物流
  49. {
  50. $logistics_type="";
  51. $logistics_fee="";
  52. $logistics_payment="";
  53. }
  54. //支付金额
  55. $price=$money;
  56. $quantity=1;
  57. $out_trade_no=$ddno?$ddno:time(); //订单号
  58. esetcookie("checkpaysession",$out_trade_no,0); //设置定单号
  59. //产品信息
  60. $subject=$productname; //商品名称
  61. $body=$productsay; //商品描述
  62. //md5
  63. $parameter=array(
  64. 'agent' => $agent,
  65. 'service' => $service,
  66. 'partner' => $partner,
  67. 'seller_email' => $seller_email,
  68. '_input_charset' => $_input_charset,
  69. 'notify_url' => $notify_url,
  70. 'return_url' => $return_url,
  71. 'subject' => $subject,
  72. 'body' => $body,
  73. 'out_trade_no' => $out_trade_no,
  74. 'price' => $price,
  75. 'quantity' => $quantity,
  76. 'payment_type' => $payment_type,
  77. 'paymethod' => $paymethod,
  78. 'defaultbank' => $defaultbank,
  79. 'logistics_type' => $logistics_type,
  80. 'logistics_fee' => $logistics_fee,
  81. 'logistics_payment' => $logistics_payment
  82. );
  83. ksort($parameter);
  84. reset($parameter);
  85. $param='';
  86. $sign='';
  87. foreach($parameter AS $key => $val)
  88. {
  89. if(strlen($val)==0)
  90. {
  91. continue;
  92. }
  93. $param.="$key=".urlencode($val)."&";
  94. $sign.="$key=$val&";
  95. }
  96. $param=substr($param,0,-1);
  97. $sign=md5(substr($sign,0,-1).$paykey);
  98. $gotopayurl='https://mapi.alipay.com/gateway.do?'.$param.'&sign='.$sign.'&sign_type='.$sign_type;
  99. ?>
  100. <html>
  101. <title>支付宝支付</title>
  102. <meta http-equiv="Cache-Control" content="no-cache"/>
  103. <body>
  104. <script>
  105. self.location.href='<?=$gotopayurl?>';
  106. </script>
  107. <input type="button" style="font-size: 9pt" value="支付宝支付" name="v_action" onclick="self.location.href='<?=$gotopayurl?>';">
  108. </body>
  109. </html>