功能场景说明:
1. 支付宝商户向其他支付宝账户单笔转账;
2. 目前仅支持账户余额渠道付款;
3.可集成到商户自身业务系统,无需登录支付宝,可用于商户间的货款结算,商户给个人用户发放佣金等;
4.提现场景/发放工资场景等;
产品规则:
1.最低额度为0.1元。
2.单日转出累计额度为100万元。
3.转账给个人支付宝账户,单笔最高5万元;转账给企业支付宝账户,单笔最高10万元。
一、文档地址
文档地址:[url]https://docs.open.alipay.com/309[/url]
二、开发前准备工作
调用步骤:[url]https://openclub.alipay.com/read.php?tid=12194&fid=69[/url]
注意事项:1、支持沙箱测试;2、需(企业账户)签约并添加功能;3、不支持第三方调用。
检查调用appid的应用功能列表中是否添加“单笔转账到支付宝账户”。
三、转账接口集成示例代码
1、参数说明
(1)out_biz_no:参数是自定义的;
(2)payee_type为ALIPAY_USERID,payee_account要设置为支付宝账号对应的支付宝唯一用户号,以2088开头的16位纯数字,可以通过用户信息授权接口([url]https://docs.open.alipay.com/289/105656[/url])获取;
payee_type为ALIPAY_LOGONID,payee_account要设置为支付宝登录号,支持邮箱和手机号格式。目前无接口可以获取,商户可自行获取使用;
(3)amount:转账金额,单位:元。只支持2位小数,金额必须大于等于0.1元。
(4)payer_show_name:付款方姓名(最长支持100个英文/50个汉字)。显示为收款方的账单详情页的对方账户。如果该字段不传,则默认显示付款方的支付宝认证姓名或单位名称。
(5)payee_real_name:收款方真实姓名(最长支持100个英文/50个汉字)。如果本参数不为空,支付宝系统则会自动校验该账户在支付宝登记的实名是否与收款方真实姓名一致。
(6)remark:转账备注(支持200个英文/100个汉字)。当付款方为企业账户,且转账金额达到(大于等于)50000元,remark不能为空。收款方可见,会展示在收款用户的账单详情中的理由。
2、JAVA版请求示例
public static void main(String[] args) throws AlipayApiException { AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.URL ,AlipayConfig.APPID,AlipayConfig.RSA_PRIVATE_KEY,"json",AlipayConfig.CHARSET,AlipayConfig.ALIPAY_PUBLIC_KEY,AlipayConfig.SignType); AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest(); request.setBizContent("{"+ "\"out_biz_no\":\"314232787878432\"," + "\"payee_type\":\"ALIPAY_LOGONID\"," + "\"payee_account\":\"dvnvqi3054@sandbox.com\"," + //amount:转账金额,金额必须大于等于0.1元。 "\"amount\":\"12.23\"," + "\"payer_show_name\":\"煜雨测试单笔转账\"," + //payee_real_name:收款方真实姓名.必须和支付中的实名一致,设置后支付宝系统会自动进行校验。 "\"payee_real_name\":\"沙箱环境\"," + "\"remark\":\"转账备注\""+ "}"); AlipayFundTransToaccountTransferResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用成功"); } else { System.out.println("调用失败"); } System.out.println(response.getBody()); }
接口调用成功示例:
调用成功 {"alipay_fund_trans_toaccount_transfer_response":{"code":"10000","msg":"Success","order_id":"20180817110070001502260000128736","out_biz_no":"314232787878432","pay_date":"2018-08-17 15:15:48"},"sign":"O6f8FieCFNaivab9CJW/3QBXzTB3NLBD3bjMjkBsDWfKZDIlzkilvF3zaFZdzuJ13TzjQY9VqqiDlisfsYPEufNNcNd4lTILeUKD9/DyPVJrmSEoF/1949fZGuSuhyhXuE8LtFx9wJowp+b5pfqTXAFDfkz2IP2RWaOQTj9i3mJ0R+6eMYwhH/sThyNSD6I56Z0/XQNYXrqLBxtONaWne40JxPxU0DeTFI9ql4PLT9gpNtvHwQSbit61A7uqpI5/Rv9UEZgCcEG8dpL86fcbMinp6taJimTdHBBhK6if/Qi0ALLzQaL18NaVYDoGAjWQSRMghAdygDS2b+MuNx8yvg=="}
3、PHP版请求示例
include_once '../config.php'; require_once '../AopSdk.php'; $request = new AlipayFundTransToaccountTransferRequest (); $request->setBizContent("{" . ""out_biz_no":"20190214ygygtransfer11111004"," . ""payee_type":"ALIPAY_USERID"," . ""payee_account":"2088102174701092"," . ""amount":0.10," . ""payer_show_name":"煜雨测试单笔转账"," . //支付宝账单中显示为对方账户和打款方名称 //""payee_real_name":"沙箱环境"," . ""remark":"转账备注"" . //支付宝账单中显示为理由 "}"); $result = $aop->execute ( $request); var_dump($result);
接口调用成功示例:
public 'alipay_fund_trans_toaccount_transfer_response' => object(stdClass)[10] public 'code' => string '10000' (length=5) public 'msg' => string 'Success' (length=7) public 'order_id' => string '20190214110070001502260000232975' (length=32) public 'out_biz_no' => string '20190214ygygtransfer11111001' (length=28) public 'pay_date' => string '2019-02-14 15:06:22' (length=19) public 'sign' => string 'pgc2lIfNRTkmqf9ljLfj1osalzMVuwtreQInkMmVpaV6GgQDOMwr6qmVYkk0hSFNQ78IlA0mVx5e+iSACjipm/MrJ5GKNb1oQ+fh5FF8QHyu8bbVAK+ILlFU2hgaXLq8CtHCHbJEJ/tRVdDfJqwlRVzjjR51Ehnp4AaI5NXMkIIoeuH7Nfd2/jMuzF9Hq15z2WfJsfbqUj1H04NQAVKKmrpknjAbirfy7tteH+9F5l5TeTZ/mycG/tbddqOUBlCOaBE/CpO860oJxx8sf29JpDtpNJ1CpDyVos8fidvKDwlboQ3Qr2iXgE/z4VuDleEjp3pOK+BBpyKs9VEde/UOog==' (length=344)
4、.NET版请求示例
IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false); AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest(); request.BizContent="{" + ""out_biz_no":"20190327ygyg12121210001"," + ""payee_type":"ALIPAY_USERID"," + ""payee_account":"2088102174701092"," + ""amount":"0.10"," + ""payer_show_name":"煜雨测试单笔转账"," + //支付宝账单中显示为对方账户和打款方名称 ""payee_real_name":"沙箱环境"," + ""remark":"转账备注"" + //支付宝账单中显示为理由 "}"; AlipayFundTransToaccountTransferResponse response = client.Execute(request);
接口调用成功示例:
{"alipay_fund_trans_toaccount_transfer_response":{"code":"10000","msg":"Success","order_id":"20190327110070001502260000262864","out_biz_no":"20190327ygyg12121210001","pay_date":"2019-03-27 14:56:11"},"sign":"Mnyg1kg9Ek98s9uayVXdvK6M9B6FToj74vqp8IcXl4ShdSNlHKLBktyAYszQq8Lao+hxWb9kr2K1fpYTMq5jUji7BwQxyHmoLAUgiWdSbq7Vgc+o8FfQ34I6ZKS6K0km5b0axKUxVaKkXLzYO5BFK1arFQwyjzMZAXiRHaRpOudmzhoG+BVeB1WIqdXNvoTpeeYvp0IN7WHtjO4eaXMdCm4ZCEqyvFP3yAz0SRFr6dcwboytzT29DoFyWlHFeG2QTBRRmDr+7EJV87lae2xBUGPEITuIlxL44o4PtriguuMWusjG/icZ4hRMOG0MkJcAhV9kkjBOB9YyLhh+h5T4FQ=="}
四、查询转账订单接口请求示例
1、参数说明
out_biz_no:参数值是转账接口返回的out_biz_no参数值,不是自定义的;
2、Java版请求示例
public static void main(String[] args) throws AlipayApiException { AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.URL ,AlipayConfig.APPID,AlipayConfig.RSA_PRIVATE_KEY,"json",AlipayConfig.CHARSET,AlipayConfig.ALIPAY_PUBLIC_KEY,AlipayConfig.SignType); AlipayFundTransOrderQueryRequest request = new AlipayFundTransOrderQueryRequest(); request.setBizContent("{" + ""out_biz_no":"314232787878432"," + ""order_id":"20180817110070001502260000128736"" + "}"); AlipayFundTransOrderQueryResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用成功"); } else { System.out.println("调用失败"); } System.out.println(response.getBody()); }
接口调用成功示例:
调用成功 {"alipay_fund_trans_order_query_response":{"code":"10000","msg":"Success","order_fee":"0.00","order_id":"20180817110070001502260000128736","out_biz_no":"314232787878432","pay_date":"2018-08-17 15:15:48","status":"SUCCESS"},"sign":"LGm3ToOx3sA9YoSaafDRbjH6sPRFgKISUAywZFQsEHBKG2EZr8ekDwK6+2McqrkQdXZ6VLexRmIXQE51KRuUqOidoXvzQWwCBnZ6CQz7BetukujdMq38Bx6fMX2uMFGHr4XsfIFSO01J3ZY+XRld63o7+AjYqM/L1sXe4qa1UQXnoKHyi3FQTvmQlKe4W01tCv7bIQ0IoGaUHQx3CrHxLb+nrfpgANJEneMBfWO0cw62PEnEwKteYy2B57uNa/7B09zpftxL2xX4ZKSg1faMKRQfcXM8h9PhRVYm7Y1AVwdiVY6QRemQ2GFLPTvXMvAI87eMrWQk3dd6brjbXJBJVA=="}
3、PHP版请求示例
include_once '../config.php'; require_once '../AopSdk.php'; $request = new AlipayFundTransOrderQueryRequest (); $request->setBizContent("{" . ""out_biz_no":"20190214ygygtransfer11111004"," . ""order_id":"20190214110070001502260000234179"" . "}"); $result = $aop->execute ( $request); var_dump($result);
接口调用成功示例:
public 'alipay_fund_trans_order_query_response' => object(stdClass)[10] public 'code' => string '10000' (length=5) public 'msg' => string 'Success' (length=7) public 'order_fee' => string '0.00' (length=4) public 'order_id' => string '20190214110070001502260000232975' (length=32) public 'out_biz_no' => string '20190214ygygtransfer11111001' (length=28) public 'pay_date' => string '2019-02-14 15:06:22' (length=19) public 'status' => string 'SUCCESS' (length=7) public 'sign' => string 'V/TQAuSJFPPjzqO6aUnqftjOm5/1dDDcFLk9llPHwdBprrSSL9aLB5YlidZbFIsDywj+l6Kkql8GzLpPE0SdnqlRxFUUoZrbtLo1OC4HMPvvSTbRA+9LHWZpWcjxW44Q6zkvUYD3qrq2dkZWMgkBqTDlUM+/rkwJP07SNIANN4SfHmA6HOv/GGzkktVjN352p+bjpoAg8xw4bgmVAxryVGf34YwbIj4SLK0Qh1LupaFqFJKCrkbU7AZCnDaUQHV58O7t5eSyVrwS0a4MFj/8wt5crOXpywAxDbMMjpmUz/mzcQzTCEyN49tubUAC2Ote9Sk5IFWHmIcpmiZJlxT/t