xinetzone/SpecWeave / .agents/skills/alipay-payment-integration
alipay-payment-integration
Flagged支付宝开放平台支付产品接入最佳实践。涵盖当面付、订单码支付、App 支付、JSAPI 支付、手机网站支付、电脑网站支付、预授权支付、商家扣款等全场景产品选型与集成指导。 当用户提到"接入支付宝"、"集成支付宝支付"、"对接支付"、"支付宝收款"、"加个支付功能"、"支付宝下单"、"H5 支付"、"小程序支付"、"预授权"、"付款码"、"扫码支付"、"网页支付"、"PC 支付"、"周期扣款"、"自动续费"、"会员订阅"、"连续包月"、"代扣"时,或咨询支付产品相关报错、排查问题时使用此 Skill。
references/code-examples/csharp/9_商家扣款/支付宝个人代扣协议查询接口代码示例.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 AlipayUserAgreementQuery
{
public static void Main(string[] args)
{
// 初始化SDK
IAopClient alipayClient = new DefaultAopClient(GetAlipayConfig());
// 构造请求参数以调用接口
AlipayUserAgreementQueryRequest request = new AlipayUserAgreementQueryRequest();
AlipayUserAgreementQueryModel model = new AlipayUserAgreementQueryModel();
// 设置协议产品码
model.PersonalProductCode = "GENERAL_WITHHOLDING_P";
// uid参数未来计划废弃,存量商户可继续使用,新商户请使用openid。请根据应用-开发配置-openid配置选择支持的字段。
// model.AlipayUserId = "2088101122675263";
// 设置用户的支付宝账号对应 的支付宝唯一用户号
model.AlipayOpenId = "074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5";
// 设置用户的支付宝登录账号
model.AlipayLogonId = "abx@alitest.com";
// 设置签约场景码
model.SignScene = "INDUSTRY|MEDICAL";
// 设置代扣协议中标示用户的唯一签约号(确保在商户系统中
model.ExternalAgreementNo = "test";
// 设置签约第三方主体类型
model.ThirdPartyType = "PARTNER";
// 设置支付宝系统中用以唯一标识用户签约记录的编号(用户签约成功后的协议号 )
model.AgreementNo = "20170322450983769228";
request.SetBizModel(model);
// 第三方代调用模式下请设置app_auth_token
// request.PutOtherTextParam("app_auth_token", "<-- 请填写应用授权令牌 -->");
AlipayUserAgreementQueryResponse 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_user_agreement_query_response": {
"code": "10000",
"msg": "Success",
"principal_id": "2088101122675263",
"principal_open_id": "074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5",
"valid_time": "2017-05-24 15:00:40",
"alipay_logon_id": "test***ali@alipay.net",
"invalid_time": "2117-05-24 00:00:00",
"pricipal_type": "CARD",
"device_id": "RSED235F875932",
"sign_scene": "INDUSTRY|CARRENTAL",
"agreement_no": "20170322450983769228",
"third_party_type": "PARTNER",
"status": "NORMAL",
"sign_time": "2017-05-24 15:00:40",
"personal_product_code": "GENERAL_WITHHOLDING_P",
"external_agreement_no": "test",
"zm_open_id": "268816057852461313538942792",
"external_logon_id": "2088101118392209",
"credit_auth_mode": "DEDUCT_HUAZHI",
"single_quota": "100.00",
"last_deduct_time": "2022-05-15",
"next_deduct_time": "2022-06-15",
"execution_plans": [
{
"single_amount": "100.00",
"period_id": "1",
"execute_time": "2024-04-29",
"latest_execute_time": "2024-05-30"
}
]
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}
```
### 异常示例
```json
{
"alipay_user_agreement_query_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 |