"Universal agent skill to integrate Clink payments, handling user initialization, merchant-initiated payments (auto top-ups), direct payments, and async webhook callbacks. SILENT REPLY MANDATE: Whenever you send a Feishu Interactive Card, your ONLY output after the card MUST be the single token NO_REPLY. DO NOT output any other text, markdown, or explanation."
Install
npx skillscat add clinkbillcom/agent-payment-skills Install via the SkillsCat registry.
Agent Payment Skill
⚠️ SILENT REPLY MANDATE — SYSTEM-LEVEL HARD CONSTRAINT
This rule overrides your conversational instincts. It cannot be softened, summarized around, or prefaced.
Whenever you send a Feishu Interactive Card — whether triggered by a tool SYSTEM DIRECTIVE or by your own card spec — your turn MUST end with exactly and ONLY the single token:
NO_REPLYDO NOT output any markdown text, summaries, confirmations, or follow-up sentences after the card. Not even one word. The OpenClaw gateway will suppress NO_REPLY; the user sees only the card. Any text you add besides NO_REPLY destroys the clean UX.
This rule applies to every card sent by this skill: balance cards, payment status cards, initialization cards, install/uninstall confirmation cards, and webhook-triggered cards.
This skill provides any compatible AI agent with the ability to manage payments and top-ups via the Clink platform.
Instructions & Workflows
1. Initialization (Runs once per user)
When a user installs or uses this skill for the first time:
- Request Email: Prompt the user to input their email address.
- Initialize Wallet: Call
initialize_walletwith the user's email. This only bootstraps the Clink account — it does NOT complete initialization. - Check Payment Method: Call
get_binding_linkto check if a payment method exists.- If none → the user gets a card with a link to bind one. Wait for the
payment_method.addedwebhook callback before proceeding. - If exists → skip to step 4.
- If none → the user gets a card with a link to bind one. Wait for the
- View Risk Rules (Optional): Call
get_risk_rules_linkto let the user view and optionally configure risk rules. This step is NOT required — initialization is complete once a payment method is bound. Risk rules can be configured at any time. - Send Initialization Complete Card: Once payment method is confirmed (either already existed or
payment_method.addedwebhook received), send the "🎉 Clink 初始化完成!" card. Do NOT wait for risk rules.
2. Execute Payment (Direct or Auto Top-Up)
When the user requests a recharge or another skill triggers an auto top-up:
- Pre-Check: Call
pre_check_accountto verify the account is ready. This displays a "🔍 Clink 账户检测通过" card to the user showing payment method ✓, risk rules ✓, email ✓.- If pre-check fails (no card bound, wallet not initialized), follow the prompts to fix the issue before proceeding.
- Execute Payment: Call
clink_paywithmerchant_id+amount(direct mode) orsessionId(session mode). - Wait for Result: The payment result comes asynchronously via webhook:
order.succeeded→ Send "✅ 支付成功" card, then use the merchant's skill/API to confirm recharge is credited.order.failed→ Send "❌ 充值失败" card with order reference for support.flag3DS=1(synchronous) → Send "🔐 3DS 验证" card with link, wait for webhook.
- Handle Failures:
- Card declined → Send switch payment method card. After receiving
payment_method.defaultChangewebhook, inform the user the new card is active and ask if they want to retry the payment. Do NOT retry automatically. - Email mismatch → Show the security block card. Do NOT retry.
- Risk rule triggered → Show options (override / modify rules / pause).
- Card declined → Send switch payment method card. After receiving
2.5 Payment Method Management
When the user asks to view or manage their payment methods:
- Show Current Status: Call
get_binding_linkto display current payment method and email as an informational card. - Open Management Page: Call
get_payment_method_modify_linkto generate the management URL. Send a "⚙️ 支付方式管理" card with the link. - Confirm Update: After the user returns from the external page, send a "✅ 支付方式已更新" card showing:
- 当前支付方式: updated ✓
- 通知邮箱: confirmed ✓
- 风控规则: 保持不变 ✓
3. Post-Installation Setup (Text-Based Workflow)
When the user asks to install this skill, the agent MUST follow this strict workflow:
Send Authorization Card:
Call thefeishu-interactive-cardsskill to sendcards/auth_request.json. Do NOT execute system modifications yet. After sending the card, replyNO_REPLYand nothing else — do NOT add any explanatory text.Wait for Text Approval:
Pause execution. Wait for the user to explicitly reply with "授权安装" or similar approval in the chat.Execute High-Risk Operations:
ONLY AFTER receiving the text approval, call theinstall_system_hookstool (or execute manually). The sequence MUST be:- Run
npm installinside the skill directory (~/.openclaw/workspace/skills/agent-payment-skills) to install required dependencies like zod and langchain. - Copy
hooks/my_payment_webhook.jsinto~/.openclaw/hooks/transforms/. - Inject
{"match": {"path": "hooks/clink/payment"}, "transform": {"module": "my_payment_webhook.js"}}intoopenclaw.jsonunderhooks.mappings. - Call
install_system_hookswithtarget_idset to the current chat's open_id (group chat ID or user ID). The tool will schedule a three-stage background script: sleep 3s → restart gateway → sleep 10s → send notification totarget_idonce the gateway is back up.
- Run
Final Confirmation before Restart:
Theinstall_system_hookstool will return a SYSTEM DIRECTIVE. You MUST follow its instructions to send the green Feishu Interactive Card ("✅ 依赖与路由注入成功") asking for the user's email. After sending it, replyNO_REPLYto end your turn. The gateway will restart automatically.Post-Restart Initialization:
When the gateway comes back online, the system will automatically send a text: "✅ 网关已重启完毕...".
Wait for the user to reply with an email address, or the exact text "使用之前的邮箱地址".
If they reply "使用之前的邮箱地址", search your conversation history/context for the most recently mentioned email address.
Once you have the email, immediately call theinitialize_wallettool with that email to complete the setup.
4. Uninstall (Text-Based Workflow)
When the user asks to uninstall this skill, the agent MUST follow the same strict workflow:
Send Uninstall Authorization Card:
Call thefeishu-interactive-cardsskill to sendcards/uninstall_request.json. Do NOT execute any destructive operations yet. After sending the card, replyNO_REPLYand nothing else — do NOT add any explanatory text.Wait for Text Approval:
Pause execution. Wait for the user to explicitly reply with "确认卸载" or similar approval in the chat.Execute Uninstall:
ONLY AFTER receiving the text approval, call theuninstall_system_hookstool withtarget_idset to the current chat's open_id (same as install). This tool will:- Remove
my_payment_webhook.jsfrom~/.openclaw/hooks/transforms/. - Remove the
hooks/clink/paymentroute mapping fromopenclaw.jsonhooks.mappings. - Remove Clink skill config (
skills.entries["agent-payment-skills"]) fromopenclaw.json. - Remove the skill directory.
- Schedule an async gateway restart (3-second delay, non-blocking).
- Remove
Final Confirmation:
The tool will return immediately. You MUST reply to the user stating: "🗑️ Clink Payment Skill 已卸载,网关将在 3 秒后自动重启生效。"
API References
- API Documentation:
https://docs.clinkbill.com/