最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

thinkphp支付宝资金下发 单笔转账

IT培训 admin 2浏览 0评论

thinkphp支付宝资金下发 单笔转账

 下载支付宝服务端对应的sdk,放到Vendor下面。

下载地址:

/***支付宝转账接口*/
public function transfer(){$out_trade_no = date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);//订单号,自己生成//1、execute 使用Vendor('aop.AopClient');Vendor('aop.request.AlipayFundTransToaccountTransferRequest');$aop = new \AopClient ();$aop->gatewayUrl = '.do';//支付宝网关$aop->appId = '商户id';$aop->rsaPrivateKey = '应用私钥,自己生成的';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'utf-8';$aop->format = 'json';$request = new \AlipayFundTransToaccountTransferRequest ();$request->setBizContent("{" ."\"out_biz_no\":\"" . 订单号 . "\"," ."\"payee_type\":\"ALIPAY_LOGONID\"," ."\"payee_account\":\"" . 支付宝帐号 . "\"," ."\"amount\":\"" . 0.1  . "\"," ."\"payer_show_name\":\"对方显示的转账人信息\"," ."\"payee_real_name\":\"\"," ."\"remark\":\"备注,超过5万必填\"" ."}");//        $result = $aop->execute($request);$result=$aop->execute($request);$responseNode=str_replace(".","_",$request->getApiMethodName())."_response";$resultCode=$result->$responseNode->code;if (!empty($resultCode) && $resultCode == 10000) {//下发成功逻辑处理} else {//下发失败}}

 

thinkphp支付宝资金下发 单笔转账

 下载支付宝服务端对应的sdk,放到Vendor下面。

下载地址:

/***支付宝转账接口*/
public function transfer(){$out_trade_no = date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);//订单号,自己生成//1、execute 使用Vendor('aop.AopClient');Vendor('aop.request.AlipayFundTransToaccountTransferRequest');$aop = new \AopClient ();$aop->gatewayUrl = '.do';//支付宝网关$aop->appId = '商户id';$aop->rsaPrivateKey = '应用私钥,自己生成的';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'utf-8';$aop->format = 'json';$request = new \AlipayFundTransToaccountTransferRequest ();$request->setBizContent("{" ."\"out_biz_no\":\"" . 订单号 . "\"," ."\"payee_type\":\"ALIPAY_LOGONID\"," ."\"payee_account\":\"" . 支付宝帐号 . "\"," ."\"amount\":\"" . 0.1  . "\"," ."\"payer_show_name\":\"对方显示的转账人信息\"," ."\"payee_real_name\":\"\"," ."\"remark\":\"备注,超过5万必填\"" ."}");//        $result = $aop->execute($request);$result=$aop->execute($request);$responseNode=str_replace(".","_",$request->getApiMethodName())."_response";$resultCode=$result->$responseNode->code;if (!empty($resultCode) && $resultCode == 10000) {//下发成功逻辑处理} else {//下发失败}}

 

发布评论

评论列表 (0)

  1. 暂无评论