国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

92 行
3.5KB

  1. <?php
  2. //财付通 网上支付接口
  3. /*这里替换为您的实际商户号*/
  4. $strSpid = $payment_userid[0];
  5. /*strSpkey是32位商户密钥, 请替换为您的实际密钥*/
  6. $strSpkey = $payment_key[0];
  7. /*银行类型:
  8. 0 财付通
  9. 1001 招商银行
  10. 1002 中国工商银行
  11. 1003 中国建设银行
  12. 1004 上海浦东发展银行
  13. 1005 中国农业银行
  14. 1006 中国民生银行
  15. 1008 深圳发展银行
  16. 1009 兴业银行 */
  17. if(!isset($BankType)) $BankType = 0;
  18. $BankType = preg_replace("#[^0-9]#","",$BankType);
  19. if($BankType < 1) $BankType = 0;
  20. $strBankType= $BankType;
  21. $strCmdNo = "1";
  22. $strBillDate= date('Ymd');
  23. /*商品名称*/
  24. if(!isset($pname)) $pname = '服务购买';
  25. $strDesc = $pname;
  26. /*用户QQ号码, 现在置为空串*/
  27. $strBuyerId = "";
  28. /*商户号*/
  29. $strSaler = $payment_userid[0];
  30. //支付手续费
  31. if($payment_exp[0] < 0) $payment_exp[0] = 0;
  32. $piice_ex = $price*$payment_exp[0];
  33. $price = $price+$piice_ex;
  34. //支付金额
  35. $strTotalFee = $price*100;
  36. if( $strTotalFee < 1){
  37. $dsql->Close();
  38. exit('金额不对');
  39. }
  40. $strSpBillNo = $buyid;;
  41. /*重要: 交易单号
  42. 交易单号(28位): 商户号(10位) + 日期(8位) + 流水号(10位), 必须按此格式生成, 且不能重复
  43. 如果sp_billno超过10位, 则截取其中的流水号部分加到transaction_id后部(不足10位左补0)
  44. 如果sp_billno不足10位, 则左补0, 加到transaction_id后部*/
  45. $strTransactionId = $strSpid . $strBillDate . time();
  46. /*货币类型: 1 – RMB(人民币) 2 - USD(美元) 3 - HKD(港币)*/
  47. $strFeeType = "1";
  48. /*财付通回调页面地址, 推荐使用ip地址的方式(最长255个字符)*/
  49. $strRetUrl = $cfg_basehost."/member/paycenter/tenpay/notify_handler.php";
  50. /*商户私有数据, 请求回调页面时原样返回*/
  51. $strAttach = "my_magic_string";
  52. /*生成MD5签名*/
  53. $strSignText = "cmdno=" . $strCmdNo . "&date=" . $strBillDate . "&bargainor_id=" . $strSaler .
  54. "&transaction_id=" . $strTransactionId . "&sp_billno=" . $strSpBillNo .
  55. "&total_fee=" . $strTotalFee . "&fee_type=" . $strFeeType . "&return_url=" . $strRetUrl .
  56. "&attach=" . $strAttach . "&key=" . $strSpkey;
  57. $strSign = strtoupper(md5($strSignText));
  58. /*请求支付串*/
  59. $strRequest = "cmdno=" . $strCmdNo . "&date=" . $strBillDate . "&bargainor_id=" . $strSaler .
  60. "&transaction_id=" . $strTransactionId . "&sp_billno=" . $strSpBillNo .
  61. "&total_fee=" . $strTotalFee . "&fee_type=" . $strFeeType . "&return_url=" . $strRetUrl .
  62. "&attach=" . $strAttach . "&bank_type=" . $strBankType . "&desc=" . $strDesc .
  63. "&purchaser_id=" . $strBuyerId .
  64. "&sign=" . $strSign ;
  65. $strRequestUrl = "https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi?".$strRequest;
  66. if($cfg_soft_lang == 'utf-8')
  67. {
  68. $strRequestUrl = utf82gb($strRequestUrl);
  69. echo '<html>
  70. <head>
  71. <title>转到财付通支付页面</title>
  72. </head>
  73. <body onload="document.tenpay.submit();">
  74. <form name="tenpay" action="paycenter/tenpay/tenpay_gbk_page.php?strReUrl='.urlencode($strRequestUrl).'" method="post">
  75. </form>
  76. </body>
  77. </html>';
  78. }else{
  79. echo '<html>
  80. <head>
  81. <title>转到财付通支付页面</title>
  82. </head>
  83. <body onload="document.tenpay.submit();">
  84. <form name="tenpay" action="'.$strRequestUrl.'" method="post">
  85. </form>
  86. </body>
  87. </html>';
  88. }
  89. exit;