thinkphp支付宝资金下发 单笔转账
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 {//下发失败}}
最新文章
- 有趣的SQL DIGEST
- Android权限
- Platform 概述
- Platform Builder
- 在屏幕坐标和窗口坐标之见的转换
- C++ Socket网络编程
- 大数定律,方差
- 大数定律的形象理解
- gallery3D(3)
- 告诉你什么是数字芯片和模拟芯片
- void* 指针有什么用
- YumRepo Error: All mirror URLs are not using ftp, http[s] or file解决办法
- 全国计算机考试如何查准考证号
- SimpleDateFormat api
- 如何在h5页面中调用摄像头来完成拍照之类的操作
- IDEA打包jar包,以及exe应用程序。
- Python try...except...时捕获异常时具体文件和行数
- (Python)异常处理try...except、raise
- 使用HTML写一个完整的注册页面
- gets函数用法