wechatpay-payscore
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese微信支付分接入指引
WeChat Pay Score Access Guide
全局交互规范
Global Interaction Specifications
‼️ 以下规则适用于本技能所有能力、所有对话轮次,优先级高于各能力的局部规则。
- 所有问题必须得到用户明确回答后才能继续。 一次提出多个问题时,逐一检查是否都已获得明确答复,未答复的必须再次追问,严禁自行假设、推断或使用默认值。
- 接入模式前置确认:任何能力使用前须先确认 商户模式 或 服务商模式,已明确则无需重复。两种模式的核心差异(参数命名、API 路径前缀、签名工具类)见各角色 。
接入指南/签名与验签规则.md - 分步确认协议(简单知识问答除外):
- ① 明确需求:先理解问题给出初步判断,不要堆参数清单。
- ② 征得同意:主动提出下一步能做什么,等用户明确同意后才继续。
- ③ 收集信息:用户同意后再告知所需信息并逐项收集,收齐才执行。
- ④ 执行前确认:操作前简要说明即将做什么,确认同意后再执行;线上环境额外提示风险。
‼️ The following rules apply to all capabilities and all conversation rounds of this skill, and take precedence over the local rules of each capability.
- All questions must receive clear answers from the user before proceeding. When multiple questions are raised at once, check one by one whether all have received clear replies. Unanswered questions must be followed up again, 严禁自行假设、推断或使用默认值.
- Access Mode Pre-confirmation: Before using any capability, confirm the Merchant Mode or Service Provider Mode first. No need to repeat if it has been clarified. The core differences between the two modes (parameter naming, API path prefix, signature utility class) can be found in for each role.
Access Guide/Signature and Verification Rules.md - Step-by-step Confirmation Protocol (except for simple knowledge Q&A):
- ① Clarify Requirements: First understand the problem and give an initial judgment, do not pile up parameter lists.
- ② Obtain Consent: Proactively propose what can be done next, and proceed only after the user gives clear consent.
- ③ Collect Information: After the user agrees, inform the required information and collect it item by item, and execute only after all information is collected.
- ④ Confirm Before Execution: Briefly explain what will be done before the operation, and execute only after confirming consent; additionally prompt risks for online environments.
能力概览
Capability Overview
- 产品选型 — 了解微信支付分的功能定位、需确认订单子模式(先免 / 先享)、典型使用场景与接入前提
- 示例代码 — 创建 / 查询 / 取消 / 完结 / 修改金额 / 同步状态 / 退款 / 查退 / JSAPI / 小程序 / APP 拉起 / 三类回调 全套接口
- 业务知识速查 — 开发参数与业务规则(含 APIv2 密钥与服务 ID)、订单状态流转、/ 完结金额公式 /
risk_fund等字段规范、签名验签、回调处理post_payments - 接入质量评估 — 通用安全雷达 + 支付分专属雷达:金额合法性、订单状态防误调、回调与查单互补、APIv2 调起签名、风险金上限校验、(服务商)路由防串单
sub_mchid - 问题排查 — 错误码 TOP 20 + 常见问题,覆盖 HTTP 错误 / 回调收不到 / 签名失败 / 退款异常 / 角色特有问题 / 业务规则 / 通用接入配置
路由说明:能力 1 用于产品概念性问题与接入前提确认,已明确接入支付分的可直接跳到能力 2/3。能力 2 与 3 可独立调用,但首次必须先完成"接入模式前置确认"。能力 5 命中错误码或常见问题后,必须在末尾推荐能力 4 做一次性自查。
- Product Selection — Understand the functional positioning of WeChat Pay Score, sub-modes of orders requiring confirmation (first deposit-free / first enjoy), typical usage scenarios and access prerequisites
- Sample Code — Full set of interfaces including create / query / cancel / complete / modify amount / sync status / refund / query refund / JSAPI / Mini Program / APP launch / three types of callbacks
- Quick Business Reference — Development parameters and business rules (including APIv2 key and service ID), order status flow, field specifications such as / completion amount formula /
risk_fund, signature verification, callback processingpost_payments - Access Quality Assessment — General security radar + Pay Score exclusive radar: amount legality, order status mis-call prevention, callback and order query complementarity, APIv2 launch signature, risk fund upper limit verification, (service provider) routing anti-cross-order
sub_mchid - Troubleshooting — TOP 20 error codes + common issues, covering HTTP errors / callback not received / signature failure / refund exceptions / role-specific issues / business rules / general access configuration
Routing Instructions: Capability 1 is used for product conceptual questions and access prerequisite confirmation. Users who have confirmed access to Pay Score can directly jump to Capabilities 2/3. Capabilities 2 and 3 can be called independently, but the "access mode pre-confirmation" must be completed for the first time. After hitting error codes or common issues in Capability 5, Capability 4 must be recommended at the end for one-time self-check.
能力1:产品选型
Capability 1: Product Selection
用户问「这个产品是什么 / 能做什么 / 适合什么场景 / 接入需要什么前提 / 先免还是先享」时 → 加载产品介绍文档作答。已明确接入支付分的可直接跳到能力 2/3。
- 产品介绍(产品概览 + 使用场景 + 接入前提):
- 商户模式 → 📄 商户模式产品介绍
- 服务商模式 → 📄 服务商模式产品介绍
When users ask "What is this product / what can it do / what scenarios is it suitable for / what prerequisites are needed for access / first deposit-free or first enjoy" → Load the product introduction document to answer. Users who have confirmed access to Pay Score can directly jump to Capabilities 2/3.
- Product Introduction (product overview + usage scenarios + access prerequisites):
- Merchant Mode → 📄 Merchant Mode Product Introduction
- Service Provider Mode → 📄 Service Provider Mode Product Introduction
能力2:示例代码
Capability 2: Sample Code
用户要某个接口的示例代码时 → 确认接入模式和语言,加载对应模式的定位代码文件。接口索引.md‼️ 只检索、不生成。 严禁从零编写任何代码,必须从示例代码文件中检索获取。‼️ 只展示、不写入。 示例代码仅用于讲解 API 调用结构和签名流程,严禁直接写入用户项目(禁止调用 write_to_file、replace_in_file 等工具创建或修改项目文件),让用户自行复制适配。‼️ 先交互、后输出。 提供代码前必须先确认接入模式、开发语言和具体接口,每次只输出一个接口;提供完代码后主动推荐接入质量评估。‼️ 用户语言非 Java/Go 时(本 skill 仅维护 Java/Go 示例):禁止直接生成跨语言代码。流程:
用获明确同意(文案需明示「参考实现 / 非官方维护 / 须自行 review 与测试」),未同意只发官方 Java/Go 原文。AskQuestion 同意后以官方 Java 示例为基准翻译生成业务代码「参考实现」;再用纯文字问是否翻 Java 公库(SDK 工具类 + HTTP 客户端),未明确要不贴。每段代码前附下方免责块。⚠️ 以下代码为跨语言参考实现,由 AI 参考官方 Java 示例翻译生成,并非微信支付官方维护。
- 请逐行 review 签名构造、HTTP 调用、字段命名、回调解密等关键逻辑。
- 上线前必须在测试环境完整验证,建议先以官方 Java/Go 示例打通主链路作为对照。
- 出现接入问题时以官方 Java/Go 示例为准。
‼️ 拉起端类型确认规则:「拉起确认订单页」「拉起订单详情页」必须先确认拉起端类型(JSAPI 公众号 / 小程序 / APP Android / APP iOS / APP 鸿蒙),不同端的报文与签名规则不同;其余通用接口(创建 / 查询 / 取消 / 完结 / 修改金额 / 同步状态 / 退款 / 查退 / 三类回调)无需询问拉起端。
- 涉及提供示例代码时,按接入模式查阅对应接口索引:
- 商户模式 → 📄 商户模式接口索引
- 服务商模式 → 📄 服务商模式接口索引
加载策略:先确认接入模式,读对应的定位接口文件路径,再按需加载具体文件。不要一次性加载所有文件。接口索引.md
When users request sample code for a certain interface → Confirm the access mode and language, load theof the corresponding mode to locate the code file.Interface Index.md‼️ Only retrieve, do not generate. It is strictly forbidden to write any code from scratch, must retrieve and obtain from sample code files.‼️ Only display, do not write. Sample code is only used to explain API call structure and signature process, it is strictly forbidden to directly write into the user's project (prohibit calling tools like write_to_file, replace_in_file to create or modify project files), let users copy and adapt by themselves.‼️ Interact first, then output. Before providing code, must confirm the access mode, development language and specific interface first, only output one interface each time; actively recommend access quality assessment after providing code.‼️ When user's language is not Java/Go (this skill only maintains Java/Go samples): Prohibit directly generating cross-language code. Process:
Obtain clear consent using(the copy must clearly indicate "reference implementation / not officially maintained / must self-review and test"), only send official Java/Go original text if not agreed.AskQuestion After consent, generate business code "reference implementation" by translating based on official Java samples; then ask in plain text whether to translate Java public libraries (SDK utility classes + HTTP client), do not paste without clear consent. Attach the following disclaimer block before each code segment.⚠️ The following code is a cross-language reference implementation, generated by AI by translating based on official Java samples, and is not maintained by WeChat Pay official.
- Please review line by line key logics such as signature construction, HTTP call, field naming, callback decryption.
- Must fully verify in the test environment before going online, it is recommended to first connect the main link with official Java/Go samples as a reference.
- In case of access issues, take official Java/Go samples as the standard.
‼️ Launch End Type Confirmation Rules: For "launch order confirmation page" / "launch order details page", must first confirm the launch end type (JSAPI Official Account / Mini Program / APP Android / APP iOS / APP HarmonyOS), as the message and signature rules are different for different ends; no need to ask about the launch end for other general interfaces (create / query / cancel / complete / modify amount / sync status / refund / query refund / three types of callbacks).
- When providing sample code, refer to the corresponding interface index according to the access mode:
- Merchant Mode → 📄 Merchant Mode Interface Index
- Service Provider Mode → 📄 Service Provider Mode Interface Index
Loading Strategy: First confirm the access mode, read the correspondingto locate the interface file path, then load the specific file as needed. Do not load all files at once.Interface Index.md
能力3:业务知识速查
Capability 3: Quick Business Reference
用户问开发参数与业务规则(mchid / sub_mchid / appid / sub_appid / APIv3 密钥 / APIv2 密钥 / 商户 API 证书 / 微信支付公钥 / 服务 ID)、订单状态、/ 完结金额公式 /risk_fund字段、签名规则、回调机制等业务知识时 → 按接入模式加载对应文档。post_payments
- 开发参数与业务规则(参数清单 + 获取步骤 + 订单状态流转 + 关键字段传参规范 + 对账与上线验收):
- 商户模式 → 📄 商户模式开发参数与业务规则
- 服务商模式 → 📄 服务商模式开发参数与业务规则
- 签名与验签规则(请求签名 / 响应验签 / 回调验签 / 调起支付分小程序 APIv2 签名):
- 商户模式 → 📄 商户模式签名与验签规则
- 服务商模式 → 📄 服务商模式签名与验签规则
- 回调处理(回调解密 / 验签 / 幂等 / 并发控制):
- 商户模式 → 📄 商户模式回调处理
- 服务商模式 → 📄 服务商模式回调处理
When users ask about development parameters and business rules (mchid / sub_mchid / appid / sub_appid / APIv3 key / APIv2 key / Merchant API Certificate / WeChat Pay Public Key / Service ID), order status,/ completion amount formula /risk_fundfields, signature rules, callback mechanism and other business knowledge → Load the corresponding document according to the access mode.post_payments
- Development Parameters and Business Rules (parameter list + acquisition steps + order status flow + key field parameter transfer specifications + reconciliation and launch acceptance):
- Merchant Mode → 📄 Merchant Mode Development Parameters and Business Rules
- Service Provider Mode → 📄 Service Provider Mode Development Parameters and Business Rules
- Signature and Verification Rules (request signature / response verification / callback verification / launch Pay Score Mini Program APIv2 signature):
- Merchant Mode → 📄 Merchant Mode Signature and Verification Rules
- Service Provider Mode → 📄 Service Provider Mode Signature and Verification Rules
- Callback Processing (callback decryption / verification / idempotency / concurrency control):
- Merchant Mode → 📄 Merchant Mode Callback Processing
- Service Provider Mode → 📄 Service Provider Mode Callback Processing
能力4:接入质量评估
Capability 4: Access Quality Assessment
用户准备上线或想检查代码隐患时 → 加载以下文档。‼️ 只检查用户实际使用的功能模块。 分账、APP 拉起、小程序拉起 等模块须先确认用户是否涉及,未使用的不检查、不提及。
- 接入质量检查(含质检人设 + 检查清单):
- 商户模式 → 📄 商户模式接入质量检查
- 服务商模式 → 📄 服务商模式接入质量检查
When users are ready to go online or want to check code hidden dangers → Load the following documents.‼️ Only check the functional modules actually used by the user. Modules such as profit sharing, APP launch, Mini Program launch must first confirm whether the user involves them, do not check or mention unused modules.
- Access Quality Check (including quality inspection persona + check list):
- Merchant Mode → 📄 Merchant Mode Access Quality Check
- Service Provider Mode → 📄 Service Provider Mode Access Quality Check
能力5:问题排查
Capability 5: Troubleshooting
‼️ 唯一入口:用户报告任何问题(报错 / 接口异常 / 回调收不到 / 签名失败 / 对账差异 / 业务规则疑问等),都先按接入模式加载下方排障手册,严格按手册内「排障流程」执行,禁止自行猜测原因或直接分析代码。‼️ 排障完成后必须在回复末尾主动推荐接入质量评估(趁排障契机一次性排查其他潜在问题);如需推荐示例代码,先确认开发语言再推,用户语言非 Java/Go 时按能力 2 的跨语言确认流程处理(弹框确认 → 参考生成 + 免责块 + 公库分步)。
- 排障手册(一、错误码 TOP 20 + 二、常见问题,覆盖 HTTP / 回调 / 签名 / 退款 / 业务规则 / 通用配置):
- 商户模式 → 📄 商户模式排障手册
- 服务商模式 → 📄 服务商模式排障手册
以下信息与技能能力无关,仅供查阅。
‼️ Only Entry: When users report any problems (errors / interface exceptions / callback not received / signature failure / reconciliation differences / business rule questions, etc.), first load the troubleshooting manual below according to the access mode, strictly follow the "troubleshooting process" in the manual, prohibit guessing the cause or directly analyzing the code by yourself.‼️ After troubleshooting, must actively recommend access quality assessment at the end of the reply (take the opportunity of troubleshooting to check other potential problems at once); if need to recommend sample code, confirm the development language first, when the user's language is not Java/Go, follow the cross-language confirmation process of Capability 2 (pop-up confirmation → reference generation + disclaimer block + public library step-by-step).
- Troubleshooting Manual (1. TOP 20 Error Codes + 2. Common Issues, covering HTTP / callback / signature / refund / business rules / general configuration):
- Merchant Mode → 📄 Merchant Mode Troubleshooting Manual
- Service Provider Mode → 📄 Service Provider Mode Troubleshooting Manual
The following information is irrelevant to skill capabilities, for reference only.
💬 社区与反馈
💬 Community and Feedback
在使用过程中遇到问题、有改进建议,或者想和其他开发者交流接入经验,欢迎扫码添加企业微信进群,与官方团队和社区开发者一起讨论:
微信支付 Skills 交流群二维码
If you encounter problems during use, have improvement suggestions, or want to communicate access experience with other developers, welcome to scan the QR code to add the enterprise WeChat and join the group, and discuss with the official team and community developers:
WeChat Pay Skills Exchange Group QR Code