支付宝预授权.net版接口请求示例

简介: download:支付宝预授权PHP版.zip说明: 本帖是.net开发语言测试支付宝预授权的请求示例,仅供参考!!  一、下载demo:Java版:download:支付宝预授权Java版.zipPHP版:download:支付宝预授权PHP版.


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

 

一、下载demo:

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

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

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

 

二、请求示例(.NET版)

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

.NET版请求示例:

IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false);            AlipayFundAuthOrderAppFreezeRequest request = new AlipayFundAuthOrderAppFreezeRequest();            request.BizContent = "{" +                    "\"out_order_no\":\"20181121ygyg454451111245031\"," +                    "\"out_request_no\":\"20181121ygyg454445486031\"," +                    "\"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\\\"}]\"" +                    "  }";            AlipayFundAuthOrderAppFreezeResponse response = client.SdkExecute(request);            Console.WriteLine(response.Body);

返回的请求参数信息:

app_id=2018022802289740&biz_content=%7b%22out_order_no%22%3a%2220181121ygyg454451111245031%22%2c%22out_request_no%22%3a%2220181121ygyg454445486031%22%2c%22order_title%22%3a%22%e7%85%9c%e9%9b%a8%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&sign_type=RSA2&timestamp=2018-12-05+17%3a25%3a43&version=1.0&sign=RyyyCs3pmxKZLBAAsu%2bvOzTJeWRw0kQcamtquBiaVJ9l3ZVQOGLedtxLRZeY3r7JABnl4rh%2fNS72ATT1Vw1QKjhd6vEoQwp9SNx9XtRKys8XeeKh4v90aKvzCKIQHVmXo0LYWt5pxWejMTyejoVeiK15VB2U%2bM0VmSJQktwwhIcKlcmuOyO2fW%2b7g18pzzcNVWeMR%2fTdik4tp%2b09zcOJFbuTjM8CB66tjJempLDQ0NF%2bD8u7RWYKJrXasxYbCIWiHxEDSwPTlRZxctKkmMLdbvv%2fa3Tx9LE2n0c1fLRcYDszBdoxQQKX9D8friqJYqmI3ySETNozokKbPOuAo80nOg%3d%3d

 

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

.NET版请求示例:
IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false);              AlipayFundAuthOperationDetailQueryRequest request = new AlipayFundAuthOperationDetailQueryRequest();                    request.BizContent = "{" +            //  "\"auth_no\":\"2014021601002000640012345678\"," +                "\"out_order_no\":\"20181122ygyg454order45111100010\"," +            //  "\"operation_id\":\"20140216010020006400\"," +                "\"out_request_no\":\"20181122ygyg454req4519120010\"" +                "}";            AlipayFundAuthOperationDetailQueryResponse response = client.Execute(request);                        Console.WriteLine(response.Body);
返回的响应参数信息示例:
{"alipay_fund_auth_operation_detail_query_response":{"code":"10000","msg":"Success","amount":"0.01","auth_no":"2018120410002001940211519175","credit_amount":"0.01","extra_param":"{}","fund_amount":"0.00","gmt_create":"2018-12-04 14:35:21","gmt_trans":"2018-12-04 14:35:28","operation_id":"20181204536554269402","operation_type":"FREEZE","order_title":"煜雨支付宝预授权冻结","out_order_no":"20181122ygyg454order45111100010","out_request_no":"20181122ygyg454req4519120010","payer_logon_id":"171****6056","payer_user_id":"2088022304381942","pre_auth_type":"CREDIT_AUTH","remark":"煜雨支付宝预授权冻结","rest_amount":"0.00","rest_credit_amount":"0.00","rest_fund_amount":"0.00","status":"SUCCESS","total_freeze_amount":"0.01","total_freeze_credit_amount":"0.01","total_freeze_fund_amount":"0.00","total_pay_amount":"0.01","total_pay_credit_amount":"0.01","total_pay_fund_amount":"0.00"},"sign":"fZttuSCurCi4ZPj00tNcRs8IZRpk8pkzXOh4hL/zRDIUiTyWBHsX/7xYyAGiN0byeziVBJ4a3Lo+MkKc3CCoqqve+Y3EItr90nA5NoCdsrMrFIhg3zLoMhLm3j7EehAKdlWVwpHEzKs0v+j33UkoAI6o17xG09vcHZVZJFEcLP0onfpPyCzxrprdIMnbwiL5JG/kidaMR69SIrMFvdE2xXm424swhOOozf6w7OHKXa9G61D2zb3eFCDy2ucU/c+OgT4U3J0jLT54bKPmvMF88mrh+x6x5ypYn7WsTGRC/3qZuMum5RUJx0ZPH5gx4qBeFyGm+bT86Wpbu1gCQrkCWQ=="}

 

授权转支付alipay.trade.pay

.NET版请求示例:

IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false);                AlipayTradePayRequest request = new AlipayTradePayRequest();            request.BizContent = "{" +                "\"out_trade_no\":\"2018092845ygyg4454448940454545977\"," +                "\"product_code\":\"PRE_AUTH_ONLINE\"," +                "\"subject\":\"煜雨授权转支付\"," +                "\"buyer_id\":\"2088112820309864\"," +                "\"seller_id\":\"2088721629150894\"," +                "\"total_amount\":0.01," +                "\"body\":\"煜雨测试\"," +                "\"auth_no\":\"2018121210002001940292964839\"" +                "}";            AlipayTradePayResponse response = client.Execute(request);            Console.WriteLine(response.Body);

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

{"alipay_trade_pay_response":{"code":"10000","msg":"Success","buyer_logon_id":"171****6056","buyer_pay_amount":"0.00","buyer_user_id":"2088022304381942","invoice_amount":"0.00","out_trade_no":"2018092845ygyg4454448940454545977","point_amount":"0.00","receipt_amount":"0.00","total_amount":"0.01","trade_no":"2018121222001481941012997618"},"sign":"apnPjicYEKPZs0v7nc6oEk3y4YvuxfVA74w+2iqq2W5Cyse3AXCuHMBSD9AepJbFAAxygoNexhLalOMbDCcHR/+csAUfYVV3nJu4vMR6INT0kCzR8Crpy7fB1/v7009YmxTt/xKeII1YgrJp6dlZIRDh2IYh50VVuijhkIA+fxMViq7gs6taZidZbpLiO8X4sbFHOwPnAnxno6ClQPhez8Qz90P3//SZhiLOJg7iMyI7PPyTpLXLBEFET3E2oKz9UhmWN8mXI3m9zoKLFulEJ9zkWyrAxheZ3MZ7HTNfR/VcKKKtFivp13ojKCux4B5Vl9FnXfkwyc9Gm3jJkcF3ZA=="}

 

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

.NET版请求示例:

 IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false);                    AlipayFundAuthOrderUnfreezeRequest request = new AlipayFundAuthOrderUnfreezeRequest();            request.BizContent="{" +                 "\"auth_no\":\"2018121210002001940296835404\"," +                  "\"out_request_no\":\"20181122ygyg454unf45454789845454\"," +   //自定义                  "\"amount\":0.03," +                  "\"remark\":\"煜雨授权解冻\""+                  "}";            AlipayFundAuthOrderUnfreezeResponse response = client.Execute(request);            Console.WriteLine(response.Body);

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

{"alipay_fund_auth_order_unfreeze_response":{"code":"10000","msg":"Success","amount":"0.03","auth_no":"2018121210002001940296835404","gmt_trans":"2018-12-12 11:16:37","operation_id":"20181212337981519402","out_order_no":"20181122ygyg454order45111100031","out_request_no":"20181122ygyg454unf45454789845454","status":"SUCCESS"},"sign":"GLwHS1abF6IU6UI92Xy9yOSTErY9RS8lT5eeNulVQiWsuLGop6k3qTUNXzDt6/uwc0c68iWFX69ZCGEcFl3MI4ClRyXYZsGW5sE5RDFnmFgK5V813b85SUoP0leZ0WAzFro88X6mNDB2TTdl46jGmDixX3ieA+3mX5lqAOpiVetwLbkzK+v4eltGbCJYLDYlHBDR1VnA+lpihhRM8f+pFt4Hx28ScebblHt07COx7zSx+0ox339xeCm64O77BeWy7/LZSoZisJIrPePvmMuSZPt6IUaWXKzyioFQk7sMdxtarI7feB2CONrUsrewpQbcUXXI2XpLxlq4agpiSadrSA=="}

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

.NET版请求示例:

 IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false);                AlipayFundAuthOperationCancelRequest request = new AlipayFundAuthOperationCancelRequest();            request.BizContent="{" +                "\"auth_no\":\"2018121210002001940293417280\"," +              //"\"out_order_no\":\"20181122ygyg454order45111100022\"," +                 "\"operation_id\":\"20181212345802279402\"," +              //"\"out_request_no\":\"20181122ygyg4544545478984578\"," +                 "\"remark\":\"煜雨授权撤销\"" +                 "}";            AlipayFundAuthOperationCancelResponse response = client.Execute(request);            Console.WriteLine(response.Body);

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

{"alipay_fund_auth_operation_cancel_response":{"code":"10000","msg":"Success","action":"unfreeze","auth_no":"2018121210002001940293417280","operation_id":"20181212345802279402","out_order_no":"20181121ygyg45445111124544545","out_request_no":"20181121ygyg454445484545"},"sign":"aD/ehJEEp9xjVTYRBRNG4iIPE68oq1R1fKucQ2JdL4MCPKlMF8CZ6ijtwm7eIvpYQu80YQLWjLThBBrEMP2CQF8dW76cN0rQz+rZJmcaG+I178/vUTkBIhQznV27MIRhTgElwmqb3WxJP3aUurDJtuVC3cUeAfmJyKRqCS7r4Sp1Q9vpCug1zeXXCPWDhQhZ2/0aFrytk1AK41y1N63y5hVJ614BGy7NGwm0DfYnZYuwrYOsBptq55bBa7TEpfnz6a0fFOGzkd/6F6l2zEVOkFtaHRL8GDCt/bJBf9IVdPKb7t5XNpWcgD0bOqCJnf0V55JigbNqovSYg6f37DkBBw=="}
目录
相关文章
|
3月前
|
API
【Azure 媒体服务】Media Service的编码示例 -- 创建缩略图子画面的.NET代码调试问题
【Azure 媒体服务】Media Service的编码示例 -- 创建缩略图子画面的.NET代码调试问题
|
3月前
|
开发框架 缓存 .NET
并发请求太多,服务器崩溃了?试试使用 ASP.NET Core Web API 操作筛选器对请求进行限流
并发请求太多,服务器崩溃了?试试使用 ASP.NET Core Web API 操作筛选器对请求进行限流
204 0
|
6月前
|
开发框架 .NET 中间件
七天.NET 8操作SQLite入门到实战 - (2)第七天Blazor班级管理页面编写和接口对接
七天.NET 8操作SQLite入门到实战 - (2)第七天Blazor班级管理页面编写和接口对接
139 7
|
3月前
|
数据采集 JSON API
异步方法与HTTP请求:.NET中提高响应速度的实用技巧
本文探讨了在.NET环境下,如何通过异步方法和HTTP请求提高Web爬虫的响应速度和数据抓取效率。介绍了使用HttpClient结合async和await关键字实现异步HTTP请求,避免阻塞主线程,并通过设置代理IP、user-agent和cookie来优化爬虫性能。提供了代码示例,演示了如何集成这些技术以绕过目标网站的反爬机制,实现高效的数据抓取。最后,通过实例展示了如何应用这些技术获取API的JSON数据,强调了这些方法在提升爬虫性能和可靠性方面的重要性。
异步方法与HTTP请求:.NET中提高响应速度的实用技巧
|
1月前
|
API
使用`System.Net.WebClient`类发送HTTP请求来调用阿里云短信API
使用`System.Net.WebClient`类发送HTTP请求来调用阿里云短信API
21 0
|
3月前
|
XML API 图形学
【Azure Developer】.Net 简单示例 "文字动图显示" Typing to SVG
【Azure Developer】.Net 简单示例 "文字动图显示" Typing to SVG
【Azure Developer】.Net 简单示例 "文字动图显示" Typing to SVG
|
3月前
|
数据采集 API 开发者
.NET 8新特性:使用ConfigurePrimaryHttpMessageHandler定制HTTP请求
在.NET 8中,通过`ConfigurePrimaryHttpMessageHandler`方法,开发者能更精细地控制HTTP请求,这对于构建高效爬虫尤为重要。此特性支持定制代理IP、管理Cookie与User-Agent,结合多线程技术,有效应对网络限制及提高数据采集效率。示例代码展示了如何设置代理服务器、模拟用户行为及并发请求,从而在遵守网站规则的同时,实现快速稳定的数据抓取。
.NET 8新特性:使用ConfigurePrimaryHttpMessageHandler定制HTTP请求
|
3月前
|
数据采集 开发框架 .NET
HttpClient在ASP.NET Core中的最佳实践:实现高效的HTTP请求
在现代Web开发中,高效可靠的HTTP请求对应用性能至关重要。ASP.NET Core提供的`HttpClient`是进行这类请求的强大工具。本文探讨其最佳实践,包括全局复用`HttpClient`实例以避免性能问题,通过依赖注入配置预设头部信息;使用代理IP以防IP被限制;设置合理的`User-Agent`和`Cookie`来模拟真实用户行为,提高请求成功率。通过这些策略,可显著增强爬虫或应用的稳定性和效率。
HttpClient在ASP.NET Core中的最佳实践:实现高效的HTTP请求
|
3月前
|
开发框架 前端开发 .NET
七天.NET 8操作SQLite入门到实战 - (3)第七天Blazor学生管理页面编写和接口对接
七天.NET 8操作SQLite入门到实战 - (3)第七天Blazor学生管理页面编写和接口对接
|
3月前
|
开发框架 前端开发 .NET
ASP.NET MVC WebApi 接口返回 JOSN 日期格式化 date format
ASP.NET MVC WebApi 接口返回 JOSN 日期格式化 date format
47 0

热门文章

最新文章