xinetzone/SpecWeave / .agents/skills/alipay-payment-integration
alipay-payment-integration
Flagged支付宝开放平台支付产品接入最佳实践。涵盖当面付、订单码支付、App 支付、JSAPI 支付、手机网站支付、电脑网站支付、预授权支付、商家扣款等全场景产品选型与集成指导。 当用户提到"接入支付宝"、"集成支付宝支付"、"对接支付"、"支付宝收款"、"加个支付功能"、"支付宝下单"、"H5 支付"、"小程序支付"、"预授权"、"付款码"、"扫码支付"、"网页支付"、"PC 支付"、"周期扣款"、"自动续费"、"会员订阅"、"连续包月"、"代扣"时,或咨询支付产品相关报错、排查问题时使用此 Skill。
references/code-examples/csharp/4_手机网站支付/手机网站支付接口代码示例.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 AlipayTradeWapPay
{
public static void Main(string[] args)
{
// 初始化SDK
IAopClient alipayClient = new DefaultAopClient(GetAlipayConfig());
// 构造请求参数以调用接口
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
AlipayTradeWapPayModel model = new AlipayTradeWapPayModel();
// 设置商户订单号
model.OutTradeNo = "70501111111S001111119";
// 设置订单总金额
model.TotalAmount = "9.00";
// 设置订单标题
model.Subject = "大乐透";
// 设置产品码
model.ProductCode = "QUICK_WAP_WAY";
// 设置针对用户授权接口
model.AuthToken = "appopenBb64d181d0146481ab6a762c00714cC27";
// 设置用户付款中途退出返回商户网站的地址
model.QuitUrl = "http://www.taobao.com/product/113714.html";
// 设置订单包含的商品列表信息
List<GoodsDetail> goodsDetail = new List<GoodsDetail>();
GoodsDetail goodsDetail0 = new GoodsDetail();
goodsDetail0.GoodsName = "ipad";
goodsDetail0.AlipayGoodsId = "20010001";
goodsDetail0.Quantity = 1;
goodsDetail0.Price = "2000";
goodsDetail0.GoodsId = "apple-01";
goodsDetail0.GoodsCategory = "34543238";
goodsDetail0.CategoriesTree = "124868003|126232002|126252004";
goodsDetail0.Body = "特价手机";
goodsDetail0.ShowUrl = "http://www.alipay.com/xxx.jpg";
goodsDetail.Add(goodsDetail0);
model.GoodsDetail = goodsDetail;
// 设置订单绝对超时时间
model.TimeExpire = "2016-12-31 10:05:00";
// 设置业务扩展参数
ExtendParams extendParams = new ExtendParams();
extendParams.SysServiceProviderId = "2088511833207846";
extendParams.HbFqSellerPercent = "100";
extendParams.HbFqNum = "3";
extendParams.IndustryRefluxInfo = "{\"scene_code\":\"metro_tradeorder\",\"channel\":\"xxxx\",\"scene_data\":{\"asset_name\":\"ALIPAY\"}}";
extendParams.RoyaltyFreeze = "true";
extendParams.CardType = "S0JP0000";
model.ExtendParams = extendParams;
// 设置商户传入业务信息
model.BusinessParams = "{\"mc_create_trade_ip\":\"127.0.0.1\"}";
// 设置公用回传参数
model.PassbackParams = "merchantBizType%3d3C%26merchantBizNo%3d2016010101111";
// 设置商户的原始订单号
model.MerchantOrderNo = "20161008001";
// 设置外部指定买家
ExtUserInfo extUserInfo = new ExtUserInfo();
extUserInfo.CertType = "IDENTITY_CARD";
extUserInfo.CertNo = "362334768769238881";
extUserInfo.Name = "李明";
extUserInfo.Mobile = "16587658765";
extUserInfo.FixBuyer = "F";
extUserInfo.MinAge = "18";
extUserInfo.NeedCheckInfo = "F";
extUserInfo.IdentityHash = "27bfcd1dee4f22c8fe8a2374af9b660419d1361b1c207e9b41a754a113f38fcc";
model.ExtUserInfo = extUserInfo;
request.SetBizModel(model);
// 第三方代调用模式下请设置app_auth_token
// request.PutOtherTextParam("app_auth_token", "<-- 请填写应用授权令牌 -->");
AlipayTradeWapPayResponse response = alipayClient.PageExecute(request, null, "POST");
// 如果需要返回GET请求,请使用
// AlipayTradeWapPayResponse response = alipayClient.PageExecute(request, null, "GET");
string pageRedirectionData = response.Body;
Console.WriteLine(pageRedirectionData);
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;
}
}
}
```
## 响应示例
### 正常示例
```html
<form name="punchout_form" method="post" action="https://openapi.alipay.com/gateway.do?charset=UTF-8&method=alipay.trade.wap.pay&format=json&sign=ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE&version=1.0&app_id=2017060101317939&sign_type=RSA2×tamp=2014-07-24+03%3A07%3A50">
<input type="hidden" name="biz_content" value="{"time_expire":"2016-12-31 10:05:00","extend_params":"","query_options":"[\"hyb_amount\",\"enterprise_pay_info\"]","quit_url":"http://www.taobao.com/product/113714.html","settle_info":"","subject":"大乐透","product_code":"QUICK_WAP_WAY","body":"Iphone6 16G","passback_params":"merchantBizType%3d3C%26merchantBizNo%3d2016010101111","specified_channel":"pcredit","goods_detail":"","merchant_order_no":"20161008001","enable_pay_channels":"pcredit,moneyFund,debitCardExpress","out_trade_no":"70501111111S001111119","ext_user_info":"","total_amount":"9.00","business_params":"{\"mc_create_trade_ip\":\"127.0.0.1\"}","timeout_express":"90m","disable_pay_channels":"pcredit,moneyFund,debitCardExpress","auth_token":"appopenBb64d181d0146481ab6a762c00714cC27"}">
<input type="submit" value="立即支付" style="display:none" >
</form>
<script>document.forms[0].submit();</script>
```
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 |