/**
* 首先要确保应用已在支付宝开放平台上线,才能调用相关接口
* 先将下载的支付宝服务端sdk全部放在 ThinkPHP/Library/Vendor 目录下,并改名为 alipay-sdk
*/
Vendor('alipay-sdk.AopSdk');
$aop = new AopClient ();
$aop->gatewayUrl = '/gateway.do';
$aop->appId = 'your app_id';
$aop->rsaPrivateKey = '请填写开发者私钥去头去尾去回车,一行字符串'; //公钥私钥对由工具或命令生成 公钥填写到支付宝开发后台
$aop->alipayrsaPublicKey='请填写支付宝公钥,一行字符串';
$aop->apiVersion = '1.0';
$aop->signType = 'RSA2';
$aop->postCharset='UTF-8';
$aop->format='json';
$request = new AlipayFundTransToaccountTransferRequest();
$request->setBizContent("{" .
"\"out_biz_no\":\"3142321423432\"," .
"\"payee_type\":\"ALIPAY_LOGONID\"," .
"\"payee_account\":\"abc@\"," .
"\"amount\":\"12.23\"," .
"\"payer_show_name\":\"上海交通卡退款\"," .
"\"payee_real_name\":\"张三\"," .
"\"remark\":\"转账备注\"" .
"}");
$result = $aop->execute ( $request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
if(!empty($resultCode)&&$resultCode == 10000){
echo "成功";
} else {
echo "失败";
}
如果觉得《php支付宝接口开发提现 ThinkPHP3.2集成 “单笔提现到支付宝账号接口”》对你有帮助,请点赞、收藏,并留下你的观点哦!