支付宝预授权PHP版请求示例


昏睡演变煎蛋
昏睡演变煎蛋 2022-09-15 14:30:42 49467
分类专栏: 资讯

**说明: ** 本帖是PHP开发语言测试支付宝预授权的请求示例,仅供参考!!

一、下载demo:

Java版:download:支付宝预授权Java版.zip

PHP版:download:支付宝预授权PHP版.zip

.NET版:download:支付宝预授权net版.zip

二、请求示例(PHP版)

线上资金授权冻结alipay.fund.auth.order.app.freeze

请示示例:

require_once 'AopSdk.php';$aop = new AopClient ();$aop->appId = '您的appid';//应用私钥:使用密钥生成工具生成的较长的那个密钥$aop->rsaPrivateKey = '应用私钥';//支付宝公钥:应用公钥上传后自动生成的$aop->alipayrsaPublicKey='支付宝公钥';$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset='utf-8';$aop->format='json';$request = new AlipayFundAuthOrderAppFreezeRequest ();$request->setBizContent("{" .		"\"out_order_no\":\"20181121ygyg454451111245001\"," .		"\"out_request_no\":\"20181121ygyg454445486001\"," .		"\"order_title\":\"煜雨测试预授权冻结\"," .		"\"amount\":0.01," .		"\"product_code\":\"PRE_AUTH_ONLINE\"," .		"\"payee_user_id\":\"2088721629150894\"," .		"\"extra_param\":\"{\\\"category\\\":\\\"CHARGE_PILE_CAR\\\"}\"," .		"\"enable_pay_channels\":\"[{\\\"payChannelType\\\":\\\"PCREDIT_PAY\\\"},{\\\"payChannelType\\\":\\\"MONEY_FUND\\\"},{\\\"payChannelType\\\":\\\"CREDITZHIMA\\\"}]\"" .		"}");$request->setNotifyUrl('您的notify_url值');$result = $aop->sdkexecute($request);print_r(htmlspecialchars($result));

返回的请求参数信息:

alipay_sdk=alipay-sdk-php-20180705&app_id=2018022802289740&biz_content=%7B%22out_order_no%22%3A%2220181121ygyg454451111245001%22%2C%22out_request_no%22%3A%2220181121ygyg454445486001%22%2C%22order_title%22%3A%22%E7%85%9C%E9%9B%A8%E6%B5%8B%E8%AF%95%E9%A2%84%E6%8E%88%E6%9D%83%E5%86%BB%E7%BB%93%22%2C%22amount%22%3A0.01%2C%22product_code%22%3A%22PRE_AUTH_ONLINE%22%2C%22payee_user_id%22%3A%222088721629150894%22%2C%22extra_param%22%3A%22%7B%5C%22category%5C%22%3A%5C%22CHARGE_PILE_CAR%5C%22%7D%22%2C%22enable_pay_channels%22%3A%22%5B%7B%5C%22payChannelType%5C%22%3A%5C%22PCREDIT_PAY%5C%22%7D%2C%7B%5C%22payChannelType%5C%22%3A%5C%22MONEY_FUND%5C%22%7D%2C%7B%5C%22payChannelType%5C%22%3A%5C%22CREDITZHIMA%5C%22%7D%5D%22%7D&charset=utf-8&format=json&method=alipay.fund.auth.order.app.freeze&notify_url=http%3A%2F%2Fnotify.dengw.online%2Fdo%2F77e754f0-0aaa-4e2c-8c45-082163bf1b28&sign_type=RSA2&timestamp=2018-12-04+05%3A47%3A50&version=1.0&sign=T8ok675mbsTHeExeaOKzIRzKzY6XKqWzjhOPViCdXJTpXM%2FjbFLFqNYHJtgXXVHmU%2FZibwUVrRef2%2BPPC1BXaUIEtAKZp9FtwGt1ezIMkJe19p7rxbvUojtiO82D1%2Fdiw%2FV0B90Fl9C3GvOywxR2iQVJ%2FnWTCV4TIMEUt8qvxE0TCK%2BfZ01QhaJz6aF9%2F%2FIKj4SjuUp0rRuVypanrMS5kgJxLQ7%2F6qQBFQ5rI%2BwlJg%2FXabDo80TzlkdHS0cVCVS97SiM3YjVrXi6tjiiJIAq5lJ7bwEcTzRCc1q0p7njyXdSvX8tIWV43h5Bi3trqtMRxv3LGErYCReJhRYAsiEpCw%3D%3D

资金授权操作查询alipay.fund.auth.operation.detail.query

请求示例:

require_once 'AopSdk.php';$aop = new AopClient ();$aop->appId = '您的appid';//应用私钥:使用密钥生成工具生成的较长的那个密钥$aop->rsaPrivateKey = '应用私钥';//支付宝公钥:应用公钥上传后自动生成的$aop->alipayrsaPublicKey='支付宝公钥';$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset='utf-8';$aop->format='json';$request = new AlipayFundAuthOperationDetailQueryRequest ();$request->setBizContent("{" .	//	"\"auth_no\":\"2014021601002000640012345678\"," .		"\"out_order_no\":\"20181122ygyg454order45111100010\"," .	//	"\"operation_id\":\"20140216010020006400\"," .		"\"out_request_no\":\"20181122ygyg454req4519120010\"" .		"}");$result = $aop->execute ( $request);var_dump($result) ;

返回的响应参数信息示例:

public 'alipay_fund_auth_operation_detail_query_response' =>     object(stdClass)[10]      public 'code' => string '10000' (length=5)      public 'msg' => string 'Success' (length=7)      public 'amount' => string '0.01' (length=4)      public 'auth_no' => string '2018120410002001940211519175' (length=28)      public 'credit_amount' => string '0.01' (length=4)      public 'extra_param' => string '{}' (length=2)      public 'fund_amount' => string '0.00' (length=4)      public 'gmt_create' => string '2018-12-04 14:35:21' (length=19)      public 'gmt_trans' => string '2018-12-04 14:35:28' (length=19)      public 'operation_id' => string '20181204536554269402' (length=20)      public 'operation_type' => string 'FREEZE' (length=6)      public 'order_title' => string '煜雨支付宝预授权冻结' (length=30)      public 'out_order_no' => string '20181122ygyg454order45111100010' (length=31)      public 'out_request_no' => string '20181122ygyg454req4519120010' (length=28)      public 'payer_logon_id' => string '171****6056' (length=11)      public 'payer_user_id' => string '2088022304381942' (length=16)      public 'pre_auth_type' => string 'CREDIT_AUTH' (length=11)      public 'remark' => string '煜雨支付宝预授权冻结' (length=30)      public 'rest_amount' => string '0.00' (length=4)      public 'rest_credit_amount' => string '0.00' (length=4)      public 'rest_fund_amount' => string '0.00' (length=4)      public 'status' => string 'SUCCESS' (length=7)      public 'total_freeze_amount' => string '0.01' (length=4)      public 'total_freeze_credit_amount' => string '0.01' (length=4)      public 'total_freeze_fund_amount' => string '0.00' (length=4)      public 'total_pay_amount' => string '0.01' (length=4)      public 'total_pay_credit_amount' => string '0.01' (length=4)      public 'total_pay_fund_amount' => string '0.00' (length=4)  public 'sign' => string 'fZttuSCurCi4ZPj00tNcRs8IZRpk8pkzXOh4hL/zRDIUiTyWBHsX/7xYyAGiN0byeziVBJ4a3Lo+MkKc3CCoqqve+Y3EItr90nA5NoCdsrMrFIhg3zLoMhLm3j7EehAKdlWVwpHEzKs0v+j33UkoAI6o17xG09vcHZVZJFEcLP0onfpPyCzxrprdIMnbwiL5JG/kidaMR69SIrMFvdE2xXm424swhOOozf6w7OHKXa9G61D2zb3eFCDy2ucU/c+OgT4U3J0jLT54bKPmvMF88mrh+x6x5ypYn7WsTGRC/3qZuMum5RUJx0ZPH5gx4qBeFyGm+bT86Wpbu1gCQrkCWQ==' (length=344)

授权转支付alipay.trade.pay

请求示例:

require_once 'AopSdk.php';$aop = new AopClient ();$aop->appId = '您的appid';//应用私钥:使用密钥生成工具生成的较长的那个密钥$aop->rsaPrivateKey = '应用私钥';//支付宝公钥:应用公钥上传后自动生成的$aop->alipayrsaPublicKey='支付宝公钥';$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset='utf-8';$aop->format='json';$request = new AlipayTradePayRequest ();$request->setBizContent("{" .			"\"out_trade_no\":\"2018092845ygyg445440989875\"," .			"\"product_code\":\"PRE_AUTH_ONLINE\"," .			"\"subject\":\"煜雨授权转支付\"," .			"\"buyer_id\":\"2088022304381942\"," .			"\"seller_id\":\"2088721629150894\"," .			"\"total_amount\":\"0.01\"," .			"\"auth_no\":\"2018120410002001940209579812\"," .			"\"body\":\"预授权解冻转支付测试\"" .			//"\"auth_confirm_mode\":\"COMPLETE\"" .			"}");$result = $aop->execute ( $request);var_dump($result) ;

返回的响应参数信息示例:

public 'alipay_trade_pay_response' =>     object(stdClass)[10]      public 'code' => string '10000' (length=5)      public 'msg' => string 'Success' (length=7)      public 'buyer_logon_id' => string '171****6056' (length=11)      public 'buyer_pay_amount' => string '0.01' (length=4)      public 'buyer_user_id' => string '2088022304381942' (length=16)      public 'fund_bill_list' =>         array (size=1)          0 =>             object(stdClass)[11]              ...      public 'gmt_payment' => string '2018-12-04 15:07:00' (length=19)      public 'invoice_amount' => string '0.01' (length=4)      public 'out_trade_no' => string '2018092845ygyg445440989875' (length=26)      public 'point_amount' => string '0.00' (length=4)      public 'receipt_amount' => string '0.01' (length=4)      public 'total_amount' => string '0.01' (length=4)      public 'trade_no' => string '2018120422001481941012557891' (length=28)  public 'sign' => string 'XWQlvsa7CqBOzYYvIQguANOKfd8bt+2gkqR7DvV5f1xPskv+FpJUx75FXE5oRzxT8khv6SEfIZ43g8psimgSbX4CWCRRRo4K88frUKUPOas9CFnmo2GfoAo5w1xQKX0DazcXoA3lv4lWcValgO3UwlfhP0fLGsTGPGhbi+1BvLQzNd1FIL1CO3o7V+fa/jzPdpjUu0yjfmSnFS6H2UpYzFuJtKJVr6ad4jkblzWl7KFojQNC9oMI4Z8LygqO2WB/6q5UEW1N2YZ7LlbJjS78Zc+9ItICjt1Om1EtrcSPuH9Uk+oBHmv0HPwOZcHQwZaqG7IpLHGjCpAbLF77JdFUPg==' (length=344)

资金授权解冻alipay.fund.auth.order.unfreeze

请求示例:

require_once 'AopSdk.php';$aop = new AopClient ();$aop->appId = '您的appid';//应用私钥:使用密钥生成工具生成的较长的那个密钥$aop->rsaPrivateKey = '应用私钥';//支付宝公钥:应用公钥上传后自动生成的$aop->alipayrsaPublicKey='支付宝公钥';$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset='utf-8';$aop->format='json';$request = new AlipayFundAuthOrderUnfreezeRequest ();$request->setBizContent("{" .		"\"auth_no\":\"2018120410002001940209579812\"," .		"\"out_request_no\":\"20181121ygygjd4544454456\"," .		"\"amount\":0.01," .		"\"remark\":\"2018-12煜雨解冻0.01元\"" .		"}");$result = $aop->execute ( $request);var_dump($result) ;

返回的响应参数信息示例:

 <code></code> 

public 'alipay_fund_auth_order_unfreeze_response' =>     object(stdClass)[10]      public 'code' => string '10000' (length=5)      public 'msg' => string 'Success' (length=7)      public 'amount' => string '0.01' (length=4)      public 'auth_no' => string '2018120410002001940209579812' (length=28)      public 'credit_amount' => string '0.01' (length=4)      public 'fund_amount' => string '0.00' (length=4)      public 'gmt_trans' => string '2018-12-04 15:01:36' (length=19)      public 'operation_id' => string '20181204480575659402' (length=20)      public 'out_order_no' => string '20181121ygyg454451111245021' (length=27)      public 'out_request_no' => string '20181121ygygjd4544454456' (length=24)      public 'status' => string 'SUCCESS' (length=7)  public 'sign' => string 'hYszbl0Wz6LHZt6xn7U3BVMsQrVtt2KGqYMZ1HlkpdQPFX5j8iuCqa9zfNbObNZkC+3LPOoH2xVLEU5p/iKUvN9RIgBqU5q0kYhbK3ngtxN+a15Mmj9MHjTl2k2gbOeEpGHhHEDhy3BHcoG0HUpZs4LnD4K9C7Eqc6g252d/7KkDnU02yL9dNX3vTBsBnfQ7PDHG5IHk0K2D6JGJ4TY4YSk4Z7y1jtiNv+J6gYgQR/0dI40sD4yCqPCbnvO2rahGlm5LBXcDaGsA64oXFzXAsLENJc7eeZpB0m0RvpmNQL/a1v04SXkQZoW8ggwHMN52WNPnn5Msj1kQ462XlqPvPw==' (length=344)

资金授权撤销alipay.fund.auth.operation.cancel

请求示例:

require_once 'AopSdk.php';$aop = new AopClient ();$aop->appId = '您的appid';//应用私钥:使用密钥生成工具生成的较长的那个密钥$aop->rsaPrivateKey = '应用私钥';//支付宝公钥:应用公钥上传后自动生成的$aop->alipayrsaPublicKey='支付宝公钥';$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset='utf-8';$aop->format='json';$request = new AlipayFundAuthOperationCancelRequest ();$request->setBizContent("{" .			"\"auth_no\":\"2018121210002001940294024373\"," .			//"\"out_order_no\":\"4977164666634053\"," .			"\"operation_id\":\"20181212362326719402\"," .			//"\"out_request_no\":\"2016100810000003551\"," .			"\"remark\":\"煜雨授权撤销\"" .			"}");$result = $aop->execute ( $request);var_dump($result) ;

返回的响应参数信息示例:

public 'alipay_fund_auth_operation_cancel_response' =>     object(stdClass)[10]      public 'code' => string '10000' (length=5)      public 'msg' => string 'Success' (length=7)      public 'action' => string 'unfreeze' (length=8)      public 'auth_no' => string '2018121210002001940294024373' (length=28)      public 'operation_id' => string '20181212362326719402' (length=20)      public 'out_order_no' => string '20181121ygyg454451111245032' (length=27)      public 'out_request_no' => string '20181121ygyg454445486032' (length=24)  public 'sign' => string 'BPnlEHSCv8iOd0FwyyEBAUXtmF5UZIAaIBKzTEV0bCW9Ctdyzmue/VYutH3c05IgcxG03t5IEgrXCZFPCcuLjX3R2KxWcZ0QiTW8jtYmXxuqSQwhc/zcKaNBwcH+c2eKsNda2HVYulw8zzj0fOas6cM9Kto/YP8elXwoBFeFwAfuG2zaKkK7YyE6OtiXRxMG9AE06bj28LCGcNOP8MLcm8ftt9ZFL/lkqg48dJORJZEqlrPvz9N6FPqtkAlcM55rjoXmLasIOtIBr8DWhaZmuBWNI7eW8QKzMtBOnmPHNi4hAZOz9lFUc+xTT2NyWaTKn5Ijq86UEZ8fhNye52ghfA==' (length=344)

网站声明:如果转载,请联系本站管理员。否则一切后果自行承担。

本文链接:https://www.xckfsq.com/news/show.html?id=67
赞同 0
评论 0 条
昏睡演变煎蛋L1
粉丝 0 发表 6 + 关注 私信
上周热门
如何使用 StarRocks 管理和优化数据湖中的数据?  2941
【软件正版化】软件正版化工作要点  2860
统信UOS试玩黑神话:悟空  2819
信刻光盘安全隔离与信息交换系统  2712
镜舟科技与中启乘数科技达成战略合作,共筑数据服务新生态  1246
grub引导程序无法找到指定设备和分区  1213
华为全联接大会2024丨软通动力分论坛精彩议程抢先看!  163
点击报名 | 京东2025校招进校行程预告  162
2024海洋能源产业融合发展论坛暨博览会同期活动-海洋能源与数字化智能化论坛成功举办  160
华为纯血鸿蒙正式版9月底见!但Mate 70的内情还得接着挖...  157
本周热议
我的信创开放社区兼职赚钱历程 40
今天你签到了吗? 27
信创开放社区邀请他人注册的具体步骤如下 15
如何玩转信创开放社区—从小白进阶到专家 15
方德桌面操作系统 14
我有15积分有什么用? 13
用抖音玩法闯信创开放社区——用平台宣传企业产品服务 13
如何让你先人一步获得悬赏问题信息?(创作者必看) 12
2024中国信创产业发展大会暨中国信息科技创新与应用博览会 9
中央国家机关政府采购中心:应当将CPU、操作系统符合安全可靠测评要求纳入采购需求 8

加入交流群

请使用微信扫一扫!