public function pay() {
Vendor('alipay.wappay.service.AlipayTradeService');
Vendor('alipay.wappay.buildermodel.AlipayTradeWapPayContentBuilder');
Vendor('alipay.aop.request.AlipayTradeWapPayRequest');
$aop = new \AopClient ();
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
$aop->appId = config('alipayconf.app_id'); //第三方应用appid
$aop->rsaPrivateKey = config('alipayconf.merchant_private_key'); //商户私钥
$aop->alipayrsaPublicKey = config('alipayconf.alipay_public_key'); //支付宝公钥,查看地址:https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
$aop->apiVersion = '1.0';
$aop->postCharset = 'utf-8';
$aop->format = 'json';
$aop->signType = 'RSA2';
//BizContent参数
$body = '测试';
$subject = '测试收费';
$out_trade_no = "CBKJ" . date("YmdHis") . rand(111, 999);
$seller_id = '2099331887318983'; //签约商家
$timeout_express = '90m';
$total_amount = '0.01';
$product_code = 'QUICK_WAP_WAY';
$request = new \AlipayTradeWapPayRequest ();
$request->setBizContent("{" .
" \"body\":\"" . $body . "\"," .
" \"subject\":\"" . $subject . "\"," .
" \"out_trade_no\":\"" . $out_trade_no . "\"," .
" \"seller_id\":\"" . $seller_id . "\"," .
" \"timeout_express\":\"" . $timeout_express . "\"," .
" \"total_amount\":\"" . $total_amount . "\"," .
" \"product_code\":\"" . $product_code . "\"" .
" }");
$request->setReturnUrl(config('alipayconf.return_url')); //回调地址
$request->setNotifyUrl(config('alipayconf.notify_url')); //异步回调地址
$app_auth_token = '202851955006D98'; //签约商家后支付宝生成的
$result = $aop->pageExecute($request, null, $app_auth_token); //注意sdk pageExecute 方法缺失$app_auth_token参数 (我下载sdk的是缺失)
print_r($result);
exit;
}
// $app_auth_token 获取
//pageExecute 方法缺失$app_auth_token参数
$sysParams[“app_auth_token”] = $appInfoAuthtoken;