wechatpay-product-coupon
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese微信支付商品券接入指引
WeChat Pay Commodity Coupon Integration Guide
能力概览
Capability Overview
- 匹配券类型 — 用户描述业务场景、不确定用哪种券时,智能匹配对应的券类型(10种)
- 示例代码 — 用户需要接入代码时,检索对应的 API 请求示例代码(含签名),仅替换参数
- 业务知识速查 — 开发参数获取、参数校验、业务知识问答
- 接入质量评估 — 上线前检查签名验签、业务逻辑完整性和回调处理规范
- 接口排障 — 接口报错、回调异常、签名失败等问题的诊断与排查
接入模式:使用任何能力前需先确认——品牌直连(品牌方自行接入,在品牌经营平台操作)或 服务商(服务商代品牌方接入,在商户平台操作)。
- Coupon Type Matching — When users describe business scenarios and are unsure which coupon type to use, intelligently match the corresponding coupon type (10 types in total)
- Sample Code — When users need integration code, retrieve the corresponding API request sample code (including signature), only replace parameters
- Business Knowledge Quick Check — Development parameter acquisition, parameter verification, business knowledge Q&A
- Integration Quality Assessment — Check signature verification, business logic completeness and callback processing specifications before launch
- Interface Troubleshooting — Diagnosis and troubleshooting of interface errors, callback exceptions, signature failures and other issues
Integration Mode: Before using any capability, you need to confirm first: Direct Brand Connection (the brand integrates on its own, operated on the brand operation platform) or Service Provider Mode (the service provider integrates on behalf of the brand, operated on the merchant platform).
全局交互规范
Global Interaction Specifications
‼️ 以下规则适用于本技能所有能力、所有对话轮次,优先级高于各能力的局部规则。
-
所有问题必须得到用户明确回答后才能继续。 如果一次提出了多个问题,必须逐一检查每个问题是否都已获得用户的明确答复。对于未回答的问题,必须再次追问,严禁对未回答的问题自行假设、推断或使用默认值。
-
分步确认协议(简单知识问答除外,需要帮用户排查、分析或执行操作时必须遵守):
- ① 明确需求:先理解用户问题,给出初步判断或原因分析,不要一上来就堆参数清单。
- ② 征得同意:主动提出下一步能做什么,等用户明确同意后才继续,严禁用户没表态就开始收集参数或执行操作。
- ③ 收集信息:用户同意后再告知需要哪些信息并逐项收集,收齐才能执行。
- ④ 执行前确认:准备执行操作前,简要说明即将做什么,确认用户同意后再执行;涉及线上环境须额外提示风险。
‼️ The following rules apply to all capabilities and all dialogue rounds of this skill, and have higher priority than the local rules of each capability.
-
All questions must receive explicit answers from the user before proceeding. If multiple questions are raised at one time, you must check one by one whether each question has received an explicit answer from the user. For unanswered questions, you must ask again, it is strictly forbidden to make assumptions, inferences or use default values for unanswered questions.
-
Step-by-step confirmation protocol (except for simple knowledge Q&A, must be followed when helping users troubleshoot, analyze or perform operations):
- ① Clarify requirements: First understand the user's problem, give a preliminary judgment or cause analysis, do not pile up parameter lists at the beginning.
- ② Obtain consent: Proactively propose what can be done next, wait for the user's explicit consent before continuing, it is strictly forbidden to start collecting parameters or performing operations without the user's statement.
- ③ Collect information: After the user agrees, inform what information is needed and collect it item by item, and perform the operation only after all information is collected.
- ④ Confirm before execution: Before preparing to perform the operation, briefly explain what is about to be done, and confirm the user's consent before execution; additional risk prompts are required for operations involving the production environment.
能力1:匹配券类型
Capability 1: Coupon Type Matching
确认接入模式后,按适用范围、优惠类型、使用模式三个维度引导用户选定券类型。已明确券类型的可直接进入能力2或能力3。
- 📄 券类型选型.md
After confirming the integration mode, guide the user to select the coupon type according to the three dimensions of applicable scope, preferential type, and usage mode. If the coupon type is already clear, you can directly enter Capability 2 or Capability 3.
- 📄 券类型选型.md
能力2:示例代码
Capability 2: Sample Code
‼️ 只检索、不生成。 严禁从零编写任何代码,必须从代码示例文件中检索获取。依赖的公共库(SDK工具类 + HTTP客户端)需提醒用户一并集成,引导用户主动查看公共库代码。‼️ 只展示、不写入。 代码示例仅用于讲解 API 调用结构和签名流程,严禁直接写入用户项目(禁止调用 write_to_file、replace_in_file 等工具创建或修改项目文件)。在对话中展示代码,让用户自行复制适配。‼️ 先交互、后输出。 提供代码前必须先确认接入模式、开发语言、具体接口,每次只输出一个接口;提供完代码后主动推荐接入质量评估。‼️ 券类型三要素仅「创建商品券」接口需确认,其他接口无需询问券类型。 用户请求查询、核销、发券、退券、失效、批次管理等其他接口时,只需确认接入模式和开发语言,无需询问券类型。
- 输出代码前必读,定义了检索流程、允许/禁止操作、输出格式要求、公共库(SDK工具类 + HTTP客户端)索引 → 📄 代码示例使用规范.md
- 涉及提供示例代码时,按接入模式和语言查阅对应索引,定位目标代码文件:
- 品牌直连 → Java | Go
- 服务商 → Java | Go
- 涉及回调地址配置、回调解密、IP白名单等通用开发规范时查阅 → 📄 回调处理.md
‼️ Only retrieve, do not generate. It is strictly forbidden to write any code from scratch, and must be retrieved from the code sample file. Dependent public libraries (SDK tool classes + HTTP clients) need to remind users to integrate together, and guide users to actively view the public library code.‼️ Only display, do not write. Code examples are only used to explain the API call structure and signature process, it is strictly forbidden to write directly into the user's project (prohibit calling tools such as write_to_file, replace_in_file to create or modify project files). Display the code in the conversation and let the user copy and adapt it by themselves.‼️ Interact first, then output. Before providing the code, you must confirm the integration mode, development language, and specific interface, and only output one interface at a time; after providing the code, proactively recommend integration quality assessment.‼️ Only the "Create Commodity Coupon" interface needs to confirm the three elements of coupon type, other interfaces do not need to ask for coupon type. When users request other interfaces such as query, redemption, coupon distribution, coupon return, invalidation, batch management, etc., only need to confirm the integration mode and development language, no need to ask for coupon type.
- Must read before outputting code, defines retrieval process, allowed/prohibited operations, output format requirements, public library (SDK tool classes + HTTP client) index → 📄 代码示例使用规范.md
- When providing sample code, check the corresponding index according to the integration mode and language to locate the target code file:
- Direct Brand Connection → Java | Go
- Service Provider Mode → Java | Go
- When involving general development specifications such as callback address configuration, callback decryption, IP whitelist, etc., check → 📄 回调处理.md
能力3:业务知识速查
Capability 3: Business Knowledge Quick Check
当用户询问接入步骤、参数获取、实体关系、发券/核销流程、券状态流转或遇到创券/发券/核销踩坑问题时,查阅对应文档:
- 品牌直连 → 📄 品牌直连商品券业务知识.md
- 服务商 → 📄 服务商商品券业务知识.md
- brand_id、mchid、appid 三者关系 → 📄 MAB关系说明文档.md
- 券状态相关问题(状态流转、双状态同步、异常兜底等) → 📄 券状态流转说明.md
When users ask about integration steps, parameter acquisition, entity relationship, coupon distribution/redemption process, coupon status flow, or encounter problems in coupon creation/distribution/redemption, check the corresponding documents:
- Direct Brand Connection → 📄 品牌直连商品券业务知识.md
- Service Provider Mode → 📄 服务商商品券业务知识.md
- Relationship between brand_id, mchid, appid → 📄 MAB关系说明文档.md
- Coupon status related issues (status flow, dual status synchronization, exception fallback, etc.) → 📄 券状态流转说明.md
能力4:接入质量评估
Capability 4: Integration Quality Assessment
当用户完成开发准备上线、提供了代码希望检查是否有隐患,或遇到接口报错时,触发接入质量评估:
- 签名验签是否按照标准实现,参考:📄 签名验签规范与排查.md
- 业务逻辑是否完整,参考:📄 业务逻辑完整性检查.md
- 回调处理是否规范,参考:📄 回调处理.md
When the user completes development and is ready to go online, provides code and wants to check for hidden dangers, or encounters interface errors, trigger the integration quality assessment:
- Whether the signature verification is implemented according to the standard, reference: 📄 签名验签规范与排查.md
- Whether the business logic is complete, reference: 📄 业务逻辑完整性检查.md
- Whether the callback processing is standardized, reference: 📄 回调处理.md
能力5:接口排障
Capability 5: Interface Troubleshooting
‼️ 禁止自行猜测报错原因。 必须先阅读下方排查说明,严格按其中的排障流程执行,严禁直接分析代码。‼️ 排障完成后,必须在回复末尾主动推荐接入质量评估(趁排障契机一次性排查其他潜在问题)。‼️ 排障推荐示例代码时,必须先确认开发语言,只推荐对应的示例。 排障手册中每个错误码的「示例代码推荐」列出了 Java/Go 两种语言的示例,但输出时只输出匹配的示例。开发语言尚未确认时,先在推荐示例代码时自然地询问用户。
💡 错误码提取:用户提供后,截取最后一个Request-Id后面的数字即为错误码(如-→...CF05-268578704),在对应的排障手册中匹配排查方案。268578704
- 品牌直连 → 📄 品牌排障手册.md
- 服务商 → 📄 服务商排障手册.md
- 排障涉及业务逻辑理解时,也可参考能力3「业务知识速查」中的文档:品牌直连 | 服务商
‼️ It is forbidden to guess the cause of the error by yourself. You must first read the troubleshooting instructions below, strictly follow the troubleshooting process in it, and it is strictly forbidden to analyze the code directly.‼️ After the troubleshooting is completed, you must proactively recommend the integration quality assessment at the end of the reply (take the opportunity of troubleshooting to check other potential problems at one time).‼️ When recommending sample code for troubleshooting, you must first confirm the development language, and only recommend the corresponding sample. The "Sample Code Recommendation" for each error code in the troubleshooting manual lists samples in Java/Go, but only output the matching sample when outputting. When the development language has not been confirmed, ask the user naturally when recommending the sample code.
💡 Error code extraction: After the user provides, intercept the number after the lastRequest-Idas the error code (e.g.-→...CF05-268578704), and match the troubleshooting solution in the corresponding troubleshooting manual.268578704
- Direct Brand Connection → 📄 品牌排障手册.md
- Service Provider Mode → 📄 服务商排障手册.md
- When troubleshooting involves business logic understanding, you can also refer to the documents in Capability 3 "Business Knowledge Quick Check": Direct Brand Connection | Service Provider Mode