Skip to content

xinetzone/SpecWeave / .agents/skills/alipay-payment-integration

alipay-payment-integration

Flagged

支付宝开放平台支付产品接入最佳实践。涵盖当面付、订单码支付、App 支付、JSAPI 支付、手机网站支付、电脑网站支付、预授权支付、商家扣款等全场景产品选型与集成指导。 当用户提到"接入支付宝"、"集成支付宝支付"、"对接支付"、"支付宝收款"、"加个支付功能"、"支付宝下单"、"H5 支付"、"小程序支付"、"预授权"、"付款码"、"扫码支付"、"网页支付"、"PC 支付"、"周期扣款"、"自动续费"、"会员订阅"、"连续包月"、"代扣"时,或咨询支付产品相关报错、排查问题时使用此 Skill。

FileKindSize
SKILL.mdskill md24.8 KB
references/alipay-sandbox/EXAMPLES.mdmarkdown1.3 KB
references/alipay-sandbox/alipay-sandbox-tool.mdmarkdown2.2 KB
references/alipay-sandbox/sandbox-setup-guide.mdmarkdown9.5 KB
references/code-examples/csharp/1_通用接口/收单退款冲退完成通知接口代码示例.mdmarkdown1.2 KB
references/code-examples/csharp/1_通用接口/查询对账单下载地址接口代码示例.mdmarkdown3.0 KB
references/code-examples/csharp/1_通用接口/统一收单交易撤销接口代码示例.mdmarkdown2.7 KB
references/code-examples/csharp/1_通用接口/统一收单交易查询接口代码示例.mdmarkdown7.1 KB
references/code-examples/csharp/1_通用接口/统一收单交易退款接口代码示例.mdmarkdown6.8 KB
references/code-examples/csharp/1_通用接口/统一收单交易退款查询接口代码示例.mdmarkdown5.9 KB
references/code-examples/csharp/2_当面付/统一收单交易支付接口代码示例.mdmarkdown6.5 KB
references/code-examples/csharp/3_订单码支付/统一收单线下交易预创建接口代码示例.mdmarkdown4.7 KB
references/code-examples/csharp/4_手机网站支付/手机网站支付接口代码示例.mdmarkdown6.8 KB
references/code-examples/csharp/5_电脑网站支付/统一收单下单并支付页面接口代码示例.mdmarkdown7.9 KB
references/code-examples/csharp/6_JSAPI支付/统一收单交易创建接口代码示例.mdmarkdown3.8 KB
references/code-examples/csharp/7_APP支付/APP支付接口代码示例.mdmarkdown5.8 KB
references/code-examples/csharp/8_预授权支付/线上资金授权冻结接口代码示例.mdmarkdown6.2 KB
references/code-examples/csharp/8_预授权支付/统一收单交易支付接口(预授权转支付)代码示例.mdmarkdown6.0 KB
references/code-examples/csharp/8_预授权支付/资金授权冻结接口代码示例.mdmarkdown5.4 KB
references/code-examples/csharp/8_预授权支付/资金授权发码接口代码示例.mdmarkdown5.2 KB
references/code-examples/csharp/8_预授权支付/资金授权撤销接口代码示例.mdmarkdown3.4 KB
references/code-examples/csharp/8_预授权支付/资金授权操作查询接口代码示例.mdmarkdown4.4 KB
references/code-examples/csharp/8_预授权支付/资金授权解冻接口代码示例.mdmarkdown3.3 KB
references/code-examples/csharp/9_商家扣款/APP支付接口(支付并签约)代码示例.mdmarkdown4.7 KB
references/code-examples/csharp/9_商家扣款/支付宝个人代扣协议查询接口代码示例.mdmarkdown4.8 KB
references/code-examples/csharp/9_商家扣款/支付宝个人代扣协议解约接口代码示例.mdmarkdown3.9 KB
references/code-examples/csharp/9_商家扣款/统一收单交易支付接口(商家扣款)代码示例.mdmarkdown6.4 KB
references/code-examples/interface-guide.mdmarkdown12.5 KB
references/code-examples/java/1_通用接口/收单退款冲退完成通知接口代码示例.mdmarkdown1.3 KB
references/code-examples/java/1_通用接口/查询对账单下载地址接口代码示例.mdmarkdown3.4 KB
references/code-examples/java/1_通用接口/统一收单交易撤销接口代码示例.mdmarkdown3.0 KB
references/code-examples/java/1_通用接口/统一收单交易查询接口代码示例.mdmarkdown7.4 KB
references/code-examples/java/1_通用接口/统一收单交易退款接口代码示例.mdmarkdown7.2 KB
references/code-examples/java/1_通用接口/统一收单交易退款查询接口代码示例.mdmarkdown6.3 KB
references/code-examples/java/2_当面付/统一收单交易支付接口代码示例.mdmarkdown6.9 KB
references/code-examples/java/3_订单码支付/统一收单线下交易预创建接口代码示例.mdmarkdown5.0 KB
references/code-examples/java/4_手机网站支付/手机网站支付接口代码示例.mdmarkdown7.1 KB
references/code-examples/java/5_电脑网站支付/统一收单下单并支付页面接口代码示例.mdmarkdown8.2 KB
references/code-examples/java/6_JSAPI支付/统一收单交易创建接口代码示例.mdmarkdown4.2 KB
references/code-examples/java/7_APP支付/APP支付接口代码示例.mdmarkdown6.1 KB
references/code-examples/java/8_预授权支付/线上资金授权冻结接口代码示例.mdmarkdown6.5 KB
references/code-examples/java/8_预授权支付/统一收单交易支付接口(预授权转支付)代码示例.mdmarkdown6.5 KB
references/code-examples/java/8_预授权支付/资金授权冻结接口代码示例.mdmarkdown5.9 KB
references/code-examples/java/8_预授权支付/资金授权发码接口代码示例.mdmarkdown5.6 KB
references/code-examples/java/8_预授权支付/资金授权撤销接口代码示例.mdmarkdown3.8 KB
references/code-examples/java/8_预授权支付/资金授权操作查询接口代码示例.mdmarkdown4.8 KB
references/code-examples/java/8_预授权支付/资金授权解冻接口代码示例.mdmarkdown3.8 KB
references/code-examples/java/9_商家扣款/APP支付接口(支付并签约)代码示例.mdmarkdown5.1 KB
references/code-examples/java/9_商家扣款/支付宝个人代扣协议查询接口代码示例.mdmarkdown5.1 KB
references/code-examples/java/9_商家扣款/支付宝个人代扣协议解约接口代码示例.mdmarkdown4.2 KB
references/code-examples/java/9_商家扣款/统一收单交易支付接口(商家扣款)代码示例.mdmarkdown6.9 KB
references/code-examples/nodejs/1_通用接口/收单退款冲退完成通知接口代码示例.mdmarkdown1.1 KB
references/code-examples/nodejs/1_通用接口/查询对账单下载地址接口代码示例.mdmarkdown1.6 KB
references/code-examples/nodejs/1_通用接口/统一收单交易撤销接口代码示例.mdmarkdown1.5 KB
references/code-examples/nodejs/1_通用接口/统一收单交易查询接口代码示例.mdmarkdown5.6 KB
references/code-examples/nodejs/1_通用接口/统一收单交易退款接口代码示例.mdmarkdown4.1 KB
references/code-examples/nodejs/1_通用接口/统一收单交易退款查询接口代码示例.mdmarkdown4.4 KB
references/code-examples/nodejs/2_当面付/统一收单交易支付接口代码示例.mdmarkdown3.5 KB
references/code-examples/nodejs/3_订单码支付/统一收单线下交易预创建接口代码示例.mdmarkdown2.6 KB
references/code-examples/nodejs/4_手机网站支付/手机网站支付接口代码示例.mdmarkdown3.7 KB
references/code-examples/nodejs/5_电脑网站支付/统一收单下单并支付页面接口代码示例.mdmarkdown4.2 KB
references/code-examples/nodejs/7_APP支付/APP支付接口代码示例.mdmarkdown2.9 KB
references/code-examples/nodejs/8_预授权支付/统一收单交易支付接口(预授权转支付)代码示例.mdmarkdown3.5 KB
references/code-examples/nodejs/9_商家扣款/APP支付接口(支付并签约)代码示例.mdmarkdown2.4 KB
references/code-examples/nodejs/9_商家扣款/统一收单交易支付接口(商家扣款)代码示例.mdmarkdown3.6 KB
references/code-examples/php/1_通用接口/收单退款冲退完成通知接口代码示例.mdmarkdown664 B
references/code-examples/php/1_通用接口/查询对账单下载地址接口代码示例.mdmarkdown2.5 KB
references/code-examples/php/1_通用接口/统一收单交易撤销接口代码示例.mdmarkdown2.3 KB
references/code-examples/php/1_通用接口/统一收单交易查询接口代码示例.mdmarkdown6.6 KB
references/code-examples/php/1_通用接口/统一收单交易退款接口代码示例.mdmarkdown5.8 KB
references/code-examples/php/1_通用接口/统一收单交易退款查询接口代码示例.mdmarkdown5.4 KB
references/code-examples/php/2_当面付/统一收单交易支付接口代码示例.mdmarkdown5.4 KB
references/code-examples/php/3_订单码支付/统一收单线下交易预创建接口代码示例.mdmarkdown3.7 KB
references/code-examples/php/4_手机网站支付/手机网站支付接口代码示例.mdmarkdown5.4 KB
references/code-examples/php/5_电脑网站支付/统一收单下单并支付页面接口代码示例.mdmarkdown6.2 KB
references/code-examples/php/6_JSAPI支付/统一收单交易创建接口代码示例.mdmarkdown3.1 KB
references/code-examples/php/7_APP支付/APP支付接口代码示例.mdmarkdown4.5 KB
references/code-examples/php/8_预授权支付/线上资金授权冻结接口代码示例.mdmarkdown5.0 KB
references/code-examples/php/8_预授权支付/统一收单交易支付接口(预授权转支付)代码示例.mdmarkdown5.2 KB
references/code-examples/php/8_预授权支付/资金授权冻结接口代码示例.mdmarkdown4.6 KB
references/code-examples/php/8_预授权支付/资金授权发码接口代码示例.mdmarkdown4.3 KB
references/code-examples/php/8_预授权支付/资金授权撤销接口代码示例.mdmarkdown2.9 KB
references/code-examples/php/8_预授权支付/资金授权操作查询接口代码示例.mdmarkdown3.8 KB
references/code-examples/php/8_预授权支付/资金授权解冻接口代码示例.mdmarkdown2.9 KB
references/code-examples/php/9_商家扣款/APP支付接口(支付并签约)代码示例.mdmarkdown3.6 KB
references/code-examples/php/9_商家扣款/支付宝个人代扣协议查询接口代码示例.mdmarkdown4.2 KB
references/code-examples/php/9_商家扣款/支付宝个人代扣协议解约接口代码示例.mdmarkdown3.2 KB
references/code-examples/php/9_商家扣款/统一收单交易支付接口(商家扣款)代码示例.mdmarkdown5.4 KB
references/code-examples/python/1_通用接口/收单退款冲退完成通知接口代码示例.mdmarkdown1.3 KB
references/code-examples/python/1_通用接口/查询对账单下载地址接口代码示例.mdmarkdown2.4 KB
references/code-examples/python/1_通用接口/统一收单交易撤销接口代码示例.mdmarkdown2.2 KB
references/code-examples/python/1_通用接口/统一收单交易查询接口代码示例.mdmarkdown6.3 KB
references/code-examples/python/1_通用接口/统一收单交易退款接口代码示例.mdmarkdown5.2 KB
references/code-examples/python/1_通用接口/统一收单交易退款查询接口代码示例.mdmarkdown5.2 KB
references/code-examples/python/2_当面付/统一收单交易支付接口代码示例.mdmarkdown3.6 KB
references/code-examples/python/3_订单码支付/统一收单线下交易预创建接口代码示例.mdmarkdown2.1 KB
references/code-examples/python/4_手机网站支付/手机网站支付接口代码示例.mdmarkdown3.0 KB
references/code-examples/python/5_电脑网站支付/统一收单下单并支付页面接口代码示例.mdmarkdown3.2 KB
references/code-examples/python/7_APP支付/APP支付接口代码示例.mdmarkdown2.4 KB
references/main/alipay-sdk-reminder.mdmarkdown11.5 KB
references/main/checklist.mdmarkdown5.5 KB
references/main/product-decision.mdmarkdown4.9 KB

references/main/checklist.md

View on GitHub
# 支付宝支付集成校验清单

本文档整理了支付宝支付集成过程中的通用校验项,仅包含必须校验和高危项目。集成完成后,请逐项核对并通过校验模板输出结果。校验结果供参考,开发者务必按照支付宝最新开放平台文档进行检查。

---

## 一、密钥与安全校验

| 校验项 | 校验要求 | 说明 |
|----------|----------|----------|
| 私钥存储位置 | 私钥不得保存在客户端代码中 | 构造交易数据并签名必须在商家服务端完成,私钥绝对不能保存在商家APP客户端中,也不能从服务端下发。商户需妥善保存私钥,不建议在代码或配置中明文写入私钥,应当通过加密配置文件或秘钥管理平台进行管理 |
| 私钥日志安全 | 私钥不得出现在日志中 | 私钥的保密等级比源码高,出现在日志中将增加私钥泄露的风险 |
| 私钥仓库安全 | 私钥不得上传公共仓库 | 私钥泄露将导致应用和支付宝交互的安全性完全丧失 |

---

## 二、异步通知校验

| 校验项 | 校验要求 | 说明 |
|----------|----------|----------|
| 验签必须执行 | 收到异步通知后必须先验签 | 确保通知来自支付宝 |
| 关键信息校验 | 检验 out_trade_no、total_amount、app_id、seller_id 等商户请求关键参数| 防止伪造订单、金额篡改等 |
| 交易状态判断 | 仅 `TRADE_SUCCESS` 或 `TRADE_FINISHED` 才算支付成功 | 其他状态不算支付成功 |
| 幂等处理 | 必须进行幂等处理,过滤重复的通知 | 同一笔订单可能收到多次异步通知 |
| 响应值 | 商户侧处理成功后需返回字符串 `success` | 否则支付宝会重试通知 |
| URL 格式 | notify_url 不能包含空格和 HTML 标签 | 否则可能导致通知失败 |
| 重定向 | notify_url 不能重定向 | 重定向会导致支付宝收不到 success |
| 外网可访问 | notify_url 必须外网可访问 | 需确保支付宝服务器可访问 |

---

## 三、支付结果处理校验

| 校验项 | 校验要求 | 说明 |
|----------|----------|----------|
| 前台同步结果防范 | 前台同步跳转结果仅作通知,**不能作为支付成功的依据** | 必须以异步通知或查询接口结果为准 |
| 支付成功判断 | 仅 `trade_status` 为 `TRADE_SUCCESS` 或 `TRADE_FINISHED` 时才认定付款成功 | 其他状态不算支付成功 |
| 主动查询兜底 | 主动查询订单状态必须作为支付结果确认的兜底逻辑 | 无论异步通知是否到达,都应具备主动查询订单状态的能力,防止因网络抖动、通知延迟或丢失导致的状态不一致 |
| 未知异常处理 | 网络超时或未知异常时,必须调用查询接口确认 | 不能简单推断为成功或失败 |
| 商家资损防范 | 不依赖前台同步结果,以异步通知或查询为准 | 防止用户未付款但商家判定成功 |
| 用户资损防范 | 未确认支付结果前不要求用户再次付款 | 防止用户已付款但商家判定失败导致重复扣款 |

---

## 四、退款校验

| 校验项 | 校验要求 | 说明 |
|----------|----------|----------|
| 退款使用场景 | 所有退款业务都必须调用退款接口 | 撤销接口不能用于退款业务,撤销接口仅用于在不确定支付结果情况下对交易发起撤销 |
| 退款是否成功判断 | 退款接口返回 `fund_change=Y` 或退款查询返回 `refund_status=REFUND_SUCCESS` 才算退款成功 | 其他状态不算退款成功 |
| 退款幂等保障 | 接口未退款成功且不明确交易情况时,重试请务必保证退款请求号 out_request_no 以及请求参数一致,避免发生多次退款 | 防止多次退款 |

---

## 五、上线前校验

| 校验项 | 校验要求 | 说明 |
|----------|----------|----------|
| 网关地址切换 | 切换为生产网关 `https://openapi.alipay.com/gateway.do`|  上线前必须修改 |
| APPID 切换 | 使用生产环境的 APPID | 与沙箱 APPID 不同 |
| 密钥切换 | 使用生产环境的应用私钥和支付宝公钥 | 与沙箱密钥不同 |
| 证书切换 | 公钥证书模式需切换为生产环境证书 | 应用公钥证书、支付宝公钥证书、支付宝根证书 |
| 产品开通状态 | 确认产品已在生产环境开通 | 沙箱无需开通,生产环境需要申请开通 |
| 私钥安全 | 私钥不在代码、日志、公共仓库中明文存储 | 使用安全的方式管理私钥 |
| 日志安全 | 日志中不打印敏感信息(私钥、用户信息等) | 防止信息泄露 |
| HTTPS 通信 | 生产环境必须使用 HTTPS | 保证传输安全 |

---

## 六、集成结果校验模板

> 复制以下模板,逐项填写校验结果并输出。校验结果说明:
> - ✅ 通过:已实现且符合规范
> - ❌ 不通过:未实现或不符合规范,需整改
> - ⚠️ 部分通过:部分实现,需补充完善
> - ➖ 不适用:当前集成场景不涉及此项

### 一、校验结论
[校验结果整体结论,输出校验结果和风险情况]
---

### 二、校验清单

| 校验类别 | 校验项 | 校验结果 | 问题描述 |
|------|------|------|------|
| 密钥与安全校验 | | | |
| 异步通知校验 | | | |
| 支付结果处理校验 | | | |
| 退款校验 | | | |
| 上线前校验 | | | |
| **合计** | | | |

---

### 三、风险说明

[未通过校验项(❌不通过、⚠️部分通过)的风险说明,需要提醒用户发布前完成整改或确认风险可接受。]

---

> 📖 本文档内容整理自支付宝开放平台官方文档,如有更新请以官方文档为准。
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: 471kUpdated Claude CodeCodexVerifiedInstall
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 availableStars: 322kUpdated Claude CodeCodexVerifiedInstall