wechat-webhooks
Installation
SKILL.md
WeChat Pay Webhooks
When to Use This Skill
- How do I receive WeChat Pay webhooks (APIv3 notifications)?
- How do I verify the
Wechatpay-Signatureheader? - How do I decrypt the encrypted
resourcein a WeChat Pay notification? - How do I handle
TRANSACTION.SUCCESSorREFUND.SUCCESSevents? - Why is my WeChat Pay signature verification failing?
How WeChat Pay Notifications Work
WeChat Pay APIv3 does not use HMAC or the Standard Webhooks spec. Each notification is:
- Asymmetrically signed (SHA256withRSA) — verify with the WeChat Pay platform public key, matched by the
Wechatpay-Serialheader, over the message"{timestamp}\n{nonce}\n{body}\n". - Separately encrypted — the
resourceobject isAEAD_AES_256_GCMciphertext. Decryptresource.ciphertextwith your 32-byte APIv3 key to recover the transaction/refund JSON.
The signed body is the raw request bytes (the ciphertext envelope), so verify first, then decrypt. Always use the raw request body — never JSON.parse before verifying.