to_pay.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. if(!defined('InEmpireCMS'))
  3. {
  4. exit();
  5. }
  6. eCheckCloseMods('pay');//关闭模块
  7. //------------------ 参数开始 ------------------
  8. //商户号
  9. $bargainor_id=$payr['payuser'];
  10. //密钥
  11. $key=$payr['paykey'];
  12. //返回地址
  13. $return_url=$PayReturnUrlQz."e/payapi/tenpay/payend.php";
  14. //支付币种,1为人民币
  15. $fee_type=1;
  16. //银行类型
  17. $bank_type="0";
  18. //------------------ 参数结束 ------------------
  19. //支付金额
  20. $total_fee=$money*100;
  21. //提交的数据
  22. $strCmdNo="1"; //财付通支付为"1" (当前只支持 cmdno=1)
  23. $strBillDate=date('Ymd'); //交易日期 (yyyymmdd)
  24. $desc=$productname; //商品名称
  25. $strBuyerId=""; //QQ号码
  26. $strSpBillNo=$ddno?$ddno:time(); //订单号
  27. esetcookie("checkpaysession",$strSpBillNo,0); //设置定单号
  28. $strTransactionId=$bargainor_id.$strBillDate.substr($strSpBillNo,0,10); //交易订单号
  29. $attach=$strSpBillNo;
  30. $spbill_create_ip=egetip();
  31. //md5
  32. $strSignText="cmdno=".$strCmdNo."&date=".$strBillDate."&bargainor_id=".$bargainor_id."&transaction_id=".$strTransactionId."&sp_billno=".$strSpBillNo."&total_fee=".$total_fee."&fee_type=".$fee_type."&return_url=".$return_url."&attach=".$attach."&spbill_create_ip=".$spbill_create_ip."&key=".$key;
  33. $strSign=strtoupper(md5($strSignText));
  34. ?>
  35. <html>
  36. <title>财付通支付</title>
  37. <meta http-equiv="Cache-Control" content="no-cache"/>
  38. <body>
  39. <form action="https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi" name="dopaypost" id="dopaypost">
  40. <input type=hidden name="cmdno" value="<?echo $strCmdNo; ?>">
  41. <input type=hidden name="date" value="<?echo $strBillDate; ?>">
  42. <input type=hidden name="bank_type" value="<?echo $bank_type; ?>">
  43. <input type=hidden name="desc" value="<?echo $desc; ?>">
  44. <input type=hidden name="purchaser_id" value="<?echo $strBuyerId; ?>">
  45. <input type=hidden name="bargainor_id" value="<?echo $bargainor_id; ?>">
  46. <input type=hidden name="transaction_id" value="<?echo $strTransactionId; ?>">
  47. <input type=hidden name="sp_billno" value="<?echo $strSpBillNo; ?>">
  48. <input type=hidden name="total_fee" value="<?echo $total_fee; ?>">
  49. <input type=hidden name="fee_type" value="<?echo $fee_type; ?>">
  50. <input type=hidden name="return_url" value="<?echo $return_url; ?>">
  51. <input type=hidden name="attach" value="<?echo $attach; ?>">
  52. <input type=hidden name="spbill_create_ip" value="<?echo $spbill_create_ip; ?>">
  53. <input type=hidden name="sign" value="<?echo $strSign; ?>">
  54. <input type="submit" name="submit2" value="财付通支付">
  55. </form>
  56. <script>
  57. document.getElementById('dopaypost').submit();
  58. </script>
  59. </body>
  60. </html>