当前位置:网站首页>PHP Alipay transfer to Alipay account
PHP Alipay transfer to Alipay account
2022-07-26 01:51:00 【If you get one】
PHP Transfer from Alipay to Alipay account / payment ( Public key certificate mode ):
The sandbox environment I use here , Pay attention to modifying the gateway when calling by yourself
Create sandbox application 

public function Withdrawal($data)
{
Loader::import('alipays.aop.AopCertClient', EXTEND_PATH, '.php');
Loader::import('alipays.aop.request.AlipayFundTransUniTransferRequest', EXTEND_PATH, '.php');
$aop = new \AopCertClient();
$appCertPath = ROOT_PATH.'public/download/appCertPublicKey.crt';
$alipayCertPath =ROOT_PATH.'public/download/alipayCertPublicKey_RSA2.crt';
$rootCertPath =ROOT_PATH.'public/download/alipayRootCert.crt';
$aop->gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
$aop->appId = "2021000117624394";
$aop->rsaPrivateKey='MIIEpQIBAAKCAQEAmKyWvxvDgbMQtDL5MqKy9QDsGvuhcgNzlnoEm4ZVkSvQmau5Ch5vNkVV8Ud+ZLe15H3T3yR7fPwr+kV3bIjA2CuqQCTGRXXx/Ag/sO0mMjljy2k/ovffKHi7RZkpDvvjMVxy+U9VxLKIGGNZLDBbYnl+nOH15Ua8WfOtH8JLXUV8Jw90Q7x6QPafh+IqqJTKSa5W+8dxpCpVSAK1qK+r0IwJBqQJuMubyWrCnPe106jHduupVJhlQZc3Zhjgd5pchH3t1KK6EBLO8ArR9PXqFLXl+htb37UgEnvXa9Y10p5hWOVmt63NPUlbwv9z7sHzQ8djbaNGUaufGQjvg9nVTwIDAQABAoIBABnc8tSBAYeRK/06vVhEk4hJlbWkdt73krclCG7IPOqQv4+otXnvWeuZp0tuTw0Eyf1hC2k7puevWEvXRLnQGMsF6ptfH29Y4ZtOUmvIYLYVXsBwneUflGAow6Cwp3HwXbZY8Okm9WKS09c9zTddIb320uoEpUEn0HR0gRlmMpokDj6NgmR7S9r/GVP/qP44Xx4pk9xuFNf/htXTJKWU5PFAhHTq1GMcJXhgQ5JZnIRPkZCjsTLtnxGf0dFn84xyyxyqcGQ7CtFyalPB7jGflvuUc8bvdTzoppStq6uGICxLk7Dh9Hz9WbDEP9DiXQIF+RltbCpL8TbI+rDB/Qnmc8ECgYEAxuLTv7lWc0q3kt4LrE2IBqg7KM/1tc+w5BFEZASELKrniaie3O0mIEkZuBggw7iwkdMJStpZnWWMrVbE1SPe1AYO7bz8ozEhnPvJV0H4tJ8YmqWTJ26c8Pis3yEIpFWzLRltcsIvNJmWhrdT/MbnK9mYiLf5AshwBUkgf9VGwT8CgYEAxIR7JDz5Udm5NUSWIugjj8gsQCgtYvWIReDHwx7amAwbEroKrdWkRR3E2BkUxQzPNrIyqfVExq2IrzPb4qRWrwPFQy2o+HfLVm3onIOJ8kjwdaJlhS+EevrnW7HVvPek3+8X53Byxj9NLNPowi4yPRM9KQYvL8fnCGiibyGO1/ECgYEAgM1nixPxm+r4pkHtV2JCxOTwo0bC/0MJcTqJiyitnOv11V4BvFxNQ71zzZi6p2aV22rL6tEsFlYs3BmEkfCQH8nooyiwiNOJzEv4Ie2Urw0V9xliCriFJT43Xq3bFep2hq+gBSEjRzJsnMRfvSXnkqtyMKDMwHOksJeiV4d9MisCgYEAmqtetDXdUSOYlqlFtXGZ06eL1G8K0dFIER+KejMFfxhAEqwkjY8RvGhirmaHJ1QenwD/yS7Gk8yvQJ4DWU1ZAGRqVKZSUEUQ4BSfONh6sRvhTeSkHIA6uARUJaJBBHqw5KMs4DZrz0axOjALCRIM7m7++xPn/aZLWx3ngqoZ4DECgYEAndzv2IXZY1RCzXfV0OrZmPTGNVDwn1Ncz7Qj/Oq63NmzX2Zm8kQy1u9ws+ANV7sHQFBsVj4CDCP4yapdXlctMt2Se4yfZpfScOUP3a2yKRZxVbNF0o95dUo1UngMZD+0ojl0bQftV2ufZwH7cfUw4ty8ADEu/LWW/FMZqZpSgis=';
$aop->format ="json";
$aop->postCharset="utf-8";
$aop->signType="RSA2";
// call getPublicKey Extract public key from Alipay public key certificate
$aop->alipayrsaPublicKey = $aop->getPublicKey($alipayCertPath);
// Verify automatic download of Alipay public key certificate , If the check is opened, Alipay certificate must be guaranteed within the validity period.
$aop->isCheckAlipayPublicCert = true;
// call getCertSN Get certificate serial number
$aop->appCertSN = $aop->getCertSN($appCertPath);
// call getRootCertSN Get Alipay certificate serial number.
$aop->alipayRootCertSN = $aop->getRootCertSN($rootCertPath);
// Instantiate concreteness API Corresponding request class , The class name corresponds to the interface name
$request = new \AlipayFundTransUniTransferRequest();
$bizcontent = [
'out_biz_no' =>$data['out_biz_no'], // The order number
'trans_amount' =>$data['trans_amount'], // Actual withdrawal amount
'product_code' => "TRANS_ACCOUNT_NO_PWD",// Transfer as :TRANS_ACCOUNT_NO_PWD
'biz_scene' => 'DIRECT_TRANSFER',// Single to no secret transfer to Alipay :DIRECT_TRANSFER
'payee_info' => [
'identity' => $data['identity'], // Payee account
'identity_type' => 'ALIPAY_LOGON_ID',// Alipay login id:ALIPAY_LOGON_ID
'name' => $data['name'], // Name of payee
],
'remark' => " Interface test of single transfer to Alipay account ", // Transfer notes
];
$request->setBizContent(json_encode($bizcontent));
// This is different from normal interface calls , It uses sdkExecute
$result = $aop->execute($request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
if (!empty($resultCode) && $resultCode == 10000) {
// success
return true;
} else {
// Failure
return false;
}
}
Comments :
For personal summary , A rookie, a big guy, light spray , If you have any questions, you are welcome to testify , It would be great if it could help everyone ;
边栏推荐
- After reading this article, you should thoroughly understand how to do interface testing
- Y77. Chapter IV Prometheus' monitoring system and practice -- Prometheus' service discovery mechanism (VIII)
- Fiddler5+ lightning simulator 4.0 settings for app packet capturing
- Study notes: original code, inverse code, complement code
- [Verilog digital system design (Xia Yuwen) 3 ----- basic concepts of Verilog syntax 1]
- Overview of database stress testing methods
- Worthington木瓜蛋白酶丨从纯化的蛋白聚糖生产糖肽(附文献)
- dataframe 修改某行某列位置的值
- Add an interceptor to resttemplate to record the request response, and you also need to solve the problem that the flow is read only once
- Shell summary (1)
猜你喜欢

pt-onnx-ncnn转换的问题记录(接yolov5训练)

怎么使用宝塔面板把node全栈项目部署到服务器上

【独立站建设】shopify卖家:学会这几点,网上商店销量翻倍!

There is no setter method in grpc list under flutter. How to use related attributes

Overview of database stress testing methods
![Niuke - bm39 serialized binary tree [hard]](/img/c4/f14fe8488bbf28689fa3f02cdf4dae.png)
Niuke - bm39 serialized binary tree [hard]

推荐系统-协同过滤在Spark中的实现

销量连连夺冠,五菱的成功秘诀只有低价吗?
![[combinational logic circuit] - encoder](/img/a5/c92e0404c6a970a62595bc7a3b68cd.gif)
[combinational logic circuit] - encoder

Recommend a super good UI automation tool: uiautomator2!
随机推荐
2022 love analysis ― bank digitalization practice report
P3166 number triangle (tolerance and exclusion +gcd)
I want to know how much the Commission is for opening an account. Is it safe to open an account on your mobile phone
The import and Export button of Damon database table is gray, and the DMP file cannot be imported
y77.第四章 Prometheus大厂监控体系及实战 -- prometheus的服务发现机制(八)
How to display numbers / English time in Excel
Big view +500 cases, software teams should improve R & D efficiency in this way
Fiddler5+ lightning simulator 4.0 settings for app packet capturing
FFT is used to estimate the image resampling factor after interpolation
3、 Pinda general permission system__ pd-tools-swagger2
BGP知识点总结
[Verilog digital system design (Xia Yuwen) 4 ----- basic concepts of Verilog syntax 2]
“蔚来杯“2022牛客暑期多校训练营2 H.[Take the Elevator] 维护线段
销量连连夺冠,五菱的成功秘诀只有低价吗?
FFT用于估计插值后的图像重采样因子
Qtreewidget dotted line setting
重发布基础与配置
Understand Linglong platform unified access service from simple to deep Monet
Installing and using R in Anaconda
Proto conversion dart | project uses protobuf | fluent uses grpc