xinetzone/SpecWeave / .agents/skills/alipay-payment-integration
alipay-payment-integration
Flagged支付宝开放平台支付产品接入最佳实践。涵盖当面付、订单码支付、App 支付、JSAPI 支付、手机网站支付、电脑网站支付、预授权支付、商家扣款等全场景产品选型与集成指导。 当用户提到"接入支付宝"、"集成支付宝支付"、"对接支付"、"支付宝收款"、"加个支付功能"、"支付宝下单"、"H5 支付"、"小程序支付"、"预授权"、"付款码"、"扫码支付"、"网页支付"、"PC 支付"、"周期扣款"、"自动续费"、"会员订阅"、"连续包月"、"代扣"时,或咨询支付产品相关报错、排查问题时使用此 Skill。
references/code-examples/csharp/8_预授权支付/资金授权发码接口代码示例.md
View on GitHub# 资金授权发码接口 - C# 示例
## 请求示例
```csharp
using System;
using System.Collections.Generic;
using Aop.Api;
using Aop.Api.Request;
using Aop.Api.Response;
using Aop.Api.Domain;
using Aop.Api.Util;
namespace SdkDemoTest
{
public class AlipayFundAuthOrderVoucherCreate
{
public static void Main(string[] args)
{
// 初始化SDK
IAopClient alipayClient = new DefaultAopClient(GetAlipayConfig());
// 构造请求参数以调用接口
AlipayFundAuthOrderVoucherCreateRequest request = new AlipayFundAuthOrderVoucherCreateRequest();
AlipayFundAuthOrderVoucherCreateModel model = new AlipayFundAuthOrderVoucherCreateModel();
// 设置后付费项目
List<PostPayment> postPayments = new List<PostPayment>();
PostPayment postPayments0 = new PostPayment();
postPayments0.Amount = "0.01";
postPayments0.Name = "租金";
postPayments0.Description = "2元/小时,99元封顶";
postPayments.Add(postPayments0);
model.PostPayments = postPayments;
// 设置订单标题
model.OrderTitle = "预授权发码";
// 设置需要冻结的金额
model.Amount = "100.00";
// 设置收款账户的支付宝用户号
model.PayeeUserId = "2088102000275795";
// 设置商户授权资金订单号
model.OutOrderNo = "8077735255938023";
// 设置销售产品码
model.ProductCode = "PREAUTH_PAY";
// 设置收款账户的支付宝登录号(email或手机号)
model.PayeeLogonId = "159****5620";
// 设置无特殊需要请勿传入
model.EnablePayChannels = "[{\"payChannelType\":\"PCREDIT_PAY\"},{\"payChannelType\":\"MONEY_FUND\"}]";
// 设置免押受理台模式
model.DepositProductMode = "POSTPAY";
// 设置无特殊需要请勿传入
model.IdentityParams = "{\"identity_hash\":\"acc2b92ffc5ed9b472faa19748f10045c30434132784f774b00216a56b8841c6\",\"alipay_open_id\":\"xxxxxx\",\"alipay_user_id\":\"2088xxx\"}";
// 设置业务参数
model.BusinessParams = "{\"outRiskInfo\":\"{\"mcCreateTradeTime\":\"2022-03-11 12:46:09\",\"extraAccountCertnoLastSix\":\"000011\",\"mobileOperatingPlatform\":\"ios\",\"sysVersion\":\"15.4.2\",\"mcCreateTradeIp\":\"11.110.111.43\"}\"}";
// 设置预授权订单相对超时时间
model.TimeoutExpress = "2d";
// 设置无特殊需要请勿传入
model.DisablePayChannels = "[{\"payChannelType\":\"OPTIMIZED_MOTO\"},{\"payChannelType\":\"BIGAMOUNT_CREDIT_CARTOON\"}]";
// 设置商户本次资金操作的请求流水号
model.OutRequestNo = "8077735255938032";
// 设置业务扩展参数
model.ExtraParam = "{\"category\":\"CHARGE_PILE_CAR\",\"serviceId\":\"2020042800000000000001450466\"}";
request.SetBizModel(model);
// 第三方代调用模式下请设置app_auth_token
// request.PutOtherTextParam("app_auth_token", "<-- 请填写应用授权令牌 -->");
AlipayFundAuthOrderVoucherCreateResponse response = alipayClient.Execute(request);
if(!response.IsError)
{
Console.WriteLine("调用成功");
}
else
{
Console.WriteLine("调用失败");
}
}
private static AlipayConfig GetAlipayConfig()
{
string privateKey = "<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->";
string alipayPublicKey = "<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->";
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.ServerUrl = "https://openapi.alipay.com/gateway.do";
alipayConfig.AppId = "<-- 请填写您的AppId,例如:2019091767145019 -->";
alipayConfig.PrivateKey = privateKey;
alipayConfig.Format = "json";
alipayConfig.AlipayPublicKey = alipayPublicKey;
alipayConfig.Charset = "UTF-8";
alipayConfig.SignType = "RSA2";
return alipayConfig;
}
}
}
```
## 响应示例
### 正常示例
```json
{
"alipay_fund_auth_order_voucher_create_response": {
"code": "10000",
"msg": "Success",
"out_order_no": "8077735255938023",
"out_request_no": "8077735255938032",
"code_type": "qrCode",
"code_value": "https://qr.alipay.com/aax017928umnzqo0uswmzd3",
"code_url": "http://mobilecodec.alipay.com/show.htm?code=aeparsv2dknkqf3018556a"
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}
```
### 异常示例
```json
{
"alipay_fund_auth_order_voucher_create_response": {
"code": "20000",
"msg": "Service Currently Unavailable",
"sub_code": "isp.unknow-error",
"sub_msg": "系统繁忙"
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |