public static function aliPayApply($data){
require ‘alipay/config.php‘;
$out_biz_no = $data["apply_no"]; //提现单号
$payee_account = $data["alipay_account"]; //支付宝账号
$amount = $data["apply_amount"]; //提现金额
$remark = ‘提现到支付宝‘;
$payer_show_name = ‘壹企帮业务提现转账‘;
$payee_real_name = $data[‘alipay_realname‘];
//实例化支付接口
$aop = new \AopClient();
$aop->gatewayUrl = $config[‘gatewayUrl‘]; //支付宝网关
$aop->appId = $config[‘app_id‘];
$aop->rsaPrivateKey = $config[‘merchant_private_key‘];
$aop->alipayrsaPublicKey = $config[‘alipay_public_key‘];
$aop->apiVersion = ‘1.0‘;
$aop->signType = $config[‘sign_type‘];
$aop->postCharset = $config[‘charset‘];
$aop->format = "json";
$request = new \AlipayFundTransToaccountTransferRequest();
//
$request->setBizContent("{" .
"\"out_biz_no\":\"$out_biz_no\"," .
"\"payee_type\":\"ALIPAY_LOGONID\"," .
"\"payee_account\":\"$payee_account\"," .
"\"amount\":\"$amount\"," .
"\"remark\":\"$remark\"," .
"\"payer_show_name\":\"$payer_show_name\"," .
"\"payee_real_name\":\"$payee_real_name\"" .
"}");
$result = $aop->execute($request);//返回的是object
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
return $resultCode;
}
原文地址:https://blog.51cto.com/xihan/2446156