header("Content-type: text/html; charset=utf-8");
/*
require ROOT_PATH.'/service/AlipayTradeService.php';
require ROOT_PATH.'/buildermodel/AlipayTradeWapPayContentBuilder.php';
*/
if (!empty($_POST)){
define('ROOT_PATH',__DIR__);
require ROOT_PATH.'/db.php';
require ROOT_PATH.'/config.php';
require ROOT_PATH.'/alipay/AopClient.php';
require ROOT_PATH.'/alipay/request/AlipayTradeWapPayRequest.php';
$unixtime = time();
//商户订单号,商户网站订单系统中唯一订单号,必填
$out_trade_no = date('YmdHis',$unixtime).(mt_rand(10000,99999));
//订单名称,必填
$subject = '思缘宾馆';
//商品描述,可空
$body = '会员充值';
$total_amount = 0.01;
//超时时间
$timeout_express='10s';
$config = [
'username'=>'liwuming',
'password'=>'qsc.zse?!0913',
'prefix'=>'',
'charset'=>'utf8',
'dsn'=>'mysql:dbname=debug;host=localhost'
];
$pdo = new Db($config);
$order_data = [
'order_num'=>$out_trade_no,
'serverid'=>1,
'roleid'=>100,
'pdcid'=>100,
'amount'=>$total_amount,
'status'=>0,
'create_time'=>time(),
'uid'=>1
];
$tmp_id = $pdo->insert('charge_order',$order_data);
if($tmp_id){
$alipay_data = [
'body' => $body,
'subject' => $subject,
'out_trade_no' => $out_trade_no,
'total_amount' => $total_amount,
'timeout_express' => $timeout_express,
'productCode' => 'QUICK_WAP_WAY',
];
$alipay_content = json_encode($alipay_data,JSON_UNESCAPED_UNICODE);
$request = new AlipayTradeWapPayRequest();
$request->setNotifyUrl($alipay_config['notify_url']);
$request->setReturnUrl($alipay_config['return_url']);
$request->setBizContent ( $alipay_content);
// 首先调用支付api
//$response = $this->aopclientRequestExecute ($request,true);
$aop = new AopClient ($alipay_config);
// 开启页面信息输出
$aop->debugInfo = true;
$response = $aop->pageExecute($request,'post');
echo $response;
die;
}else{
die('创建订单失败');
}
}
?>
支付宝手机网站支付接口*{
margin:0;
padding:0;
}
ul,ol{
list-style:none;
}
body{
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
}
.hidden{
display:none;
}
.new-btn-login-sp{
padding: 1px;
display: inline-block;
width: 75%;
}
.new-btn-login {
background-color: #02aaf1;
color: #FFFFFF;
font-weight: bold;
border: none;
width: 100%;
height: 30px;
border-radius: 5px;
font-size: 16px;
}
#main{
width:100%;
margin:0 auto;
font-size:14px;
}
.red-star{
color:#f00;
width:10px;
display:inline-block;
}
.null-star{
color:#fff;
}
.content{
margin-top:5px;
}
.content dt{
width:100px;
display:inline-block;
float: left;
margin-left: 20px;
color: #666;
font-size: 13px;
margin-top: 8px;
}
.content dd{
margin-left:120px;
margin-bottom:5px;
}
.content dd input {
width: 85%;
height: 28px;
border: 0;
-webkit-border-radius: 0;
-webkit-appearance: none;
}
#foot{
margin-top:10px;
position: absolute;
bottom: 15px;
width: 100%;
}
.foot-ul{
width: 100%;
}
.foot-ul li {
width: 100%;
text-align:center;
color: #666;
}
.note-help {
color: #999999;
font-size: 12px;
line-height: 130%;
margin-top: 5px;
width: 100%;
display: block;
}
#btn-dd{
margin: 20px;
text-align: center;
}
.foot-ul{
width: 100%;
}
.one_line{
display: block;
height: 1px;
border: 0;
border-top: 1px solid #eeeeee;
width: 100%;
margin-left: 20px;
}
.am-header {
display: -webkit-box;
display: -ms-flexbox;
display: box;
width: 100%;
position: relative;
padding: 7px 0;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
background: #1D222D;
height: 50px;
text-align: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
box-pack: center;
-webkit-box-align: center;
-ms-flex-align: center;
box-align: center;
}
.am-header h1 {
-webkit-box-flex: 1;
-ms-flex: 1;
box-flex: 1;
line-height: 18px;
text-align: center;
font-size: 18px;
font-weight: 300;
color: #fff;
}
支付宝手机网站支付接口快速通道(接口名:alipay.trade.wap.pay)
-
商户订单号
:
订单名称
:
付款金额
:
商品描述:
确 认
如果您点击“确认”按钮,即表示您同意该次的执行操作。
支付宝版权所有 2015-2018 ALIPAY.COM
function GetDateNow() {
var vNow = new Date();
var sNow = "";
sNow += String(vNow.getFullYear());
sNow += String(vNow.getMonth() + 1);
sNow += String(vNow.getDate());
sNow += String(vNow.getHours());
sNow += String(vNow.getMinutes());
sNow += String(vNow.getSeconds());
sNow += String(vNow.getMilliseconds());
document.getElementById("WIDout_trade_no").value = sNow;
document.getElementById("WIDsubject").value = "测试";
document.getElementById("WIDtotal_amount").value = "0.01";
document.getElementById("WIDbody").value = "购买测试商品0.01元";
}
GetDateNow();
一键复制
编辑
Web IDE
原始数据
按行查看
历史