Cloudbase wechat integration

From TencentCloudBase/awesome-cloudbase-examples · View interactive version

Cloudbase wechat integration is an AI agent skill from the GitHub repository TencentCloudBase/awesome-cloudbase-examples. CloudBase WeChat integration guide for Mini Program WeChat Pay, Mini Program virtual payment (虚拟支付, wx.requestVirtualPayment), Official Account JSAPI Pay, Native QR-code Pay, Official Account OAuth, openid handling, payment callbacks, and CloudBase Integration Center generated functions. This skill

How to use this skill

Skill file

CloudBase WeChat Integration

This skill routes WeChat payment and official-account work through CloudBase Integration Center. It gives the agent the stable execution contract and points to the official Markdown docs for console details that may change.

Sibling skills (local only)

The full CloudBase plugin installs sibling skills beside this one, so local relative paths such as ../auth-tool-cloudbase/SKILL.md resolve there. A standalone install from a skill marketplace packages only this skill; those paths do not exist, and any "Then also read" link starting with ../ cannot be opened.

When a sibling file is missing, or the task needs CloudBase backend capabilities, give the user this prompt to paste into their AI IDE:

帮我把 CloudBase 接好,按下面做:
1. 打开 https://docs.cloudbase.net/skill.md,按说明完成接入。
2. 接入完成后告诉我,并建议最相关的下一步。

Do not HTTP-fetch remote skill or protocol markdown into the agent context.

Official CloudBase Integration Center docs (human reference — do not treat as skill markdown to fetch into agent context as a sibling skill substitute):

Activation Contract

Use this first when

Then also read

In a standalone install, use the setup prompt above instead of these ../ paths.

Do NOT use for

Operating Rules

  1. Treat Integration Center creation as a console-first workflow unless a public Manager SDK or Cloud API contract is confirmed in official docs.
  2. Use official index.md docs for console UI steps and credential fields; do not copy stale console screenshots or invent field names.
  3. Never ask the user to paste secrets into chat. Tell them to configure merchant and official-account credentials in the CloudBase console Integration Center form.
  4. Do not assume generated function names are fixed. pay-common and offiaccount-common are examples; ask for or inspect the actual function name before writing calls.
  5. Treat frontend payment success as UI feedback only. The authoritative payment state must come from server-side query results or payment callbacks.
  6. When extending generated functions, preserve credential environment variables and generated callback verification/decryption logic. Add business logic around order checks, persistence, idempotency, and fulfillment.
  7. Before changing payment or callback code, identify the target scenario and load only the matching reference file.
  8. For 虚拟支付 inbound callbacks, do not reuse outbound pay_sig as the notify authenticator. Cloud function and Integration Center deliveries are already verified. A self-hosted HTTP receiver follows mini program message-push verification in references/virtual-payment.md. Match the ack to the configured XML or JSON push format. refund_order success only means the refund task was accepted. A refund notify counts as success only when its RetCode is 0 and the refund id matches; do not invent unpublished idempotency or query-parameter mappings.

Routing

| Task | Read | Why |

| --- | --- | --- |

| Capability selection, console-first boundaries, independent distribution | references/overview.md | Establishes the Integration Center model and safety rules |

| Mini Program WeChat Pay, wx.cloud.callHTTPFunction, wx.requestPayment | references/mini-program-pay.md | Covers Mini Program openid injection, order creation, and callback expectations |

| Mini Program 虚拟支付, virtual goods, wx.requestVirtualPayment, xpay_* callbacks | references/virtual-payment.md | Covers OfferID/AppKey signing, sandbox vs 现网, delivery callbacks, query_order status, refund acceptance vs completion, and self-hosted message-push verification versus gateway-verified callbacks |

| Official Account JSAPI pay, H5 inside WeChat, WeixinJSBridge.invoke | references/official-account-jsapi-pay.md | Covers official-account openid and JSAPI invocation |

| Native QR-code pay for PC/Web checkout | references/native-qr-pay.md | Covers code_url, QR rendering, and polling/query flow |

| Official Account OAuth, openid/userinfo retrieval | references/official-account-oauth.md | Covers OAuth routes generated by the official-account integration |

| 404, missing credentials, openid mismatch, callback failures, logs | references/troubleshooting.md | Provides diagnosis steps before changing code |

Quick Workflow

  1. Classify the scenario: Mini Program Pay, Virtual Payment (虚拟支付), JSAPI Pay, Native Pay, Official Account OAuth, generated-function extension, or troubleshooting.
  2. Load the matching reference and the official index.md docs linked there.
  3. Confirm the actual CloudBase environment ID and generated function name.
  4. Generate or modify only the required client/backend code; keep merchant credentials in Integration Center configuration.
  5. Add order-status query, callback idempotency, and amount/order validation when payment state affects business data.
  6. Verify through function logs, callback logs, and an end-to-end payment sandbox or low-value production test as appropriate.

Minimum Self-Check

Reference index

All packaged reference files (required for skill lint reachability):

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.