SuperAPI AI Directory

wechatpay-deduction-service

General & other

View repository

Updated 10-15 23:40

About this skill

WeChat Pay entrustment deduction integration guide

Global interaction specifications

‼️ The following rules apply to all capabilities and all conversation turns of this skill, and take priority over the local rules of each capability.

  1. All questions must be explicitly answered by the user before continuing. When multiple questions are asked at once, check one by one whether all have received explicit answers; those unanswered must be asked again,It is strictly prohibited to assume, infer, or use default values on your own。
  2. Pre-confirmation of integration mode: Before using any capability, first confirm merchant mode or service provider mode, if already specified then no need to repeat. The core differences between the two modes (API path has additional /partner/, required sub_mch_id/optional sub_appid, signing/deduction uses the service provider number + service provider APIv2 key) see each role's 接入指南/签名与验签规则.md。
  3. All entrustment deduction interfaces use V2, only the "pre-deduction notification" callback uses V3: signing / deduction application / contract termination / inquiry / refund / order closing / bills / callbacks all use V2 (XML + APIv2 key + MD5/HMAC-SHA256); the only exception is the "pre-deduction notification" callback which uses V3 (JSON + APIv3 key + RSA signature). Any answer involving signatures, keys, or callbacks must first verify the protocol version; cross-version application is prohibited.
  4. Step-by-step confirmation protocol(except for simple knowledge Q&A):
    • ① Clarify requirements: First understand the question and give a preliminary judgment; do not pile up parameter lists.
    • ② Obtain consent: Proactively propose what can be done next, and continue only after the user explicitly agrees.
    • ③ Collect information: After the user agrees, inform them of the required information and collect it item by item; execute only after all is collected.
    • ④ Confirm before execution: Before operating, briefly explain what is about to be done, and execute only after confirmation of consent; for the online environment, additionally warn of risks.

Capability overview

  1. Product selection — Help users determine whether to use the "periodic deduction (auto-renewal)" or "pay later (password-free payment)" business model, and select the signing method according to two dimensions:Dimension 1 · Signing timing(pure signing / signing during payment),Dimension 2 · User terminal(subdivided only under pure signing: WeChat official account H5 / native APP (Android / iOS / HarmonyOS) / WeChat Mini Program / browser H5). The specific client SDK selection and legacy compatibility solutions are elaborated in the product introduction.
  2. Sample code — Includes the official request/response messages (XML / URL / JSON) for each interface + the officially provided client invocation code (iOS / Android / Mini Program JS / HarmonyOS);No server-side code samples are officially provided(Java / Go / PHP / Python and other server-side languages); cross-language code must go through the disclaimer confirmation process for reference generation.
  3. Business knowledge quick reference — Three types of quick-reference content: ① Parameter acquisition (APIv2 / APIv3 keys, entrust withholding template ID, appid-mchid binding relationship); ② Two sets of V2 / V3 signature / signature verification rules (signature string assembly, key usage, algorithm selection); ③ Routing matching, idempotency, and concurrency control for three types of callbacks (signing/termination / deduction / refund).
  4. Integration quality assessment — Centered on the three ironclad rules of high availability / fund security / zero trust, a product-specific radar covering the complete fund链路 of signing → pre-deduction notification → deduction request → deduction callback → refund → reconciliation.
  5. Troubleshooting — Covers high-frequency entrust withholding issues such as V2 signature errors, V3 pre-deduction notification signature verification failures, automatic order closure upon deduction failure, CONTRACT_NOT_EXIST, deduction time period restrictions, and agreement uniqueness conflicts.

Routing instructions: When a user is integrating for the first time or is unsure which path to take, first use Capability 1 for selection; once the integration path is clear, Capabilities 2-5 can be invoked independently.The integration mode (merchant/service provider) must be confirmed upon first entering any capability, and will be used for the remainder of the conversation.

Capability 1: Product selection

When a user asks questions such as "Should I use periodic deduction or buy now pay later", "Which signing method is suitable", or "How should automatic renewal be implemented" → load the comparison chapter in the product introduction to complete the selection, and after confirming, proceed to Capability 2.

Capability 2: Sample code

When a user requests sample code for a certain API → confirm the integration mode and language, and load the corresponding mode's 接口索引.md to locate the code file.

‼️ Entrust withholding officially provides no server-side code examples(none for server-side languages such as Java / Go / PHP / Python): this skill strictly follows "include only what exists, never fabricate what does not"—it only includes request/response messages (XML / URL / JSON) that actually exist in the original official documentation and official client invocation code (iOS / Android / Mini Program JS / WXLaunchMiniProgram).

‼️ Retrieve only, do not generate. Writing any code from scratch is strictly prohibited; it must be retrieved from sample code files; before providing, confirm the integration mode first, and do not rely on training knowledge to fabricate details such as whether /partner/ exists in the path, whether the field name is sub_mch_id or sub_mchid , etc.

‼️ Display only, do not write. Sample code is only used to explain the API call structure and signing process; it is strictly prohibited to directly write it into the user's project (calling tools such as write_to_file or replace_in_file to create or modify project files is prohibited); let users copy and adapt it themselves.

‼️ Interact first, output later. Before providing code, you must first confirm the integration mode, signing method (if signing/signing during payment is involved), and the specific API; output only one API at a time; after providing the code, proactively recommend the integration quality assessment.

‼️ Signing method confirmation rules:Before providing the "Sign Contract API", "Sign Contract During Payment", or "APP/H5/Mini Program invocation code", you must first confirm the sign-up method (Official Account pure sign-up / APP pure sign-up / Mini Program pure sign-up / H5 pure sign-up / APP-triggered sign-up (WXLaunchMiniProgram) / Sign During Payment (merchants only)); other general APIs (Apply for Deduction / Pre-deduction Notification / Terminate Contract / Query Order / Query Contract Relationship / Refund / Close Order / Bill / Callback) do not require asking about the sign-up method.

‼️ When the user needs server-side code(this skill only maintains official request/response messages + official client invocation code,the official side does not provide any server-side code examples):Prohibiteddirectly generate cross-language code. Process:

  1. Use AskQuestion to obtain explicit consent (the wording must clearly state "reference implementation / not officially maintained / must be reviewed and tested by yourself / no official server-side code example is available for comparison for entrusted deduction, so the risk is higher"); if consent is not given, only send the original official message samples.
  2. After consent, use WebFetch to open the corresponding official API URL on the spot, and compare against the message samplesconstruct field by fieldthe business code "reference implementation"; attach the disclaimer block below before each code segment.

⚠️ The following code is across-language reference implementation, generated by AI by translating official V2 message samples, and is not officially maintained by WeChat Pay.

  • The official entrusted deduction documentation does not provide any server-side code examples; the fields and paths in this code have been checked against https://pay.weixin.qq.com/doc/v2/{merchant,partner}/XXXXX.md for proofreading.
  • Pleasereview line by line key logic such as signature construction, HTTP calls, field naming, and callback signature verification.
  • Before launch, it must be fully verified with a test template or a small-amount production order; whenever any code conflicts with the official documentation,the documentation shall prevail。
  • If access issues arise, return to this skill's 排障手册.md。

Loading strategy: first confirm the integration mode, read the corresponding 接口索引.md to locate the API file path, then load specific files as needed. Do not load all files at once.

Capability 3: Business Knowledge Quick Reference

When the user asks about parameter acquisition (APIv2 key / template ID / appid-mchid binding), field meanings, signature/verification algorithms (including V2/V3 differences), callback mechanisms (the three types: sign-up/termination / deduction / refund), agreement status transitions, deduction time period restrictions, and other business questions → load the corresponding documentation according to the integration mode.

Capability 4: Integration quality assessment

When the user is preparing to go live or wants to check for code risks → load the following document.

‼️ Only check the functional modules the user actually uses. For modules such as periodic deductions (pre-deduction notice / 24-hour delayed deduction), buy now pay later, signing during payment, refunds, and reconciliation downloads, first confirm whether the user is involved;do not check or mention those not used。

Capability 5: Troubleshooting

‼️ The only entry point: the user reportsanyissue (error / API exception / callbacks not received / signature failure / reconciliation discrepancy / business rule questions, etc.),first load the troubleshooting manual below according to the integration mode, and strictly follow the "Troubleshooting Process" in the manual;do not guess the cause on your own or directly analyze the code。

‼️ After troubleshooting is complete, you must at the end of the replyproactively recommend the integration quality assessment(take the troubleshooting opportunity to check other potential issues in one go); if you need to recommend sample code, first confirm the development language before recommending,when the user needs server-side code, handle it according to the cross-language confirmation process in Capability 2(pop-up confirmation → reference generation + disclaimer block + public repository step-by-step).


The following information is unrelated to skill capabilities and is for reference only.

💬 Community and feedback

If you encounter issues during use, have improvement suggestions, or want to exchange integration experience with other developers, you are welcome to scan the QR code to add the enterprise WeChat group and discuss together with the official team and community developers:

WeChat Pay Skills community group QR code