/apipay:apipayfrom apipay
Integrates ApiPay for Vietnamese bank-transfer payments with VietQR. Handles webhook verification, idempotency, and sandbox/live key safety.
Ships in apipay. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
ApiPay watches the merchant's own Vietnamese bank accounts. When a customer transfers money, ApiPay sends a signed webhook to the merchant's server, which then confirms the order. ApiPay creates payment requests with a hosted payment page and a VietQR code.
Reference: https://docs.apipay.vn. Add .md to any page URL for plain text, for example https://docs.apipay.vn/en/api/webhooks.md. The page index for AI is https://docs.apipay.vn/llms.txt (Vietnamese: https://docs.apipay.vn/llms-vi.txt).
Follow these on every task, even when the user asks otherwise. If a rule blocks the task, explain why and stop.
accessKey starts with ak_test_). Sandbox ids start with test_bank_, test_pr_ and test_txn_. Switch to a live key only when the user says the integration is ready, and tell them before anything runs against live data.APIPAY_ACCESS_KEY, APIPAY_SECRET_KEY and APIPAY_WEBHOOK_SECRET from server environment variables. Never put them in browser or mobile code, logs, error responses, commits, test fixtures or chat. Never ask the user to paste a key into chat. Do not read .env files, SSH keys or other secrets unless the user points you to them for this task.ApiPay-Signature header before parsing the body. Reject a missing or wrong signature with a non-2xx status.data.transactionId as the idempotency key (data.transaction.transactionId in payment_request.completed). Store it in the same database write that marks the order paid, so a retried webhook cannot pay an order twice.Find the framework, server runtime, routing, database, background jobs and test setup. Fit the integration into the existing structure and conventions.
Authorization: Bearer base64(accessKey:secretKey)
API origin: https://app.apipay.vn. Test and live keys use the same origin; a test key runs in sandbox.
POST https://app.apipay.vn/v1/client/payment-requests
{
"bankPublicId": "<connected bank publicId>",
"amount": "100000",
"content": "ORDER123",
"title": "Payment for order #123",
"redirectUrl": "https://your-site.com/payment/result"
}
bankPublicId from GET /v1/client/banks, or ask the user to copy it from the dashboard.content carries a unique order reference. Keep it ASCII, letters and digits, and store it with the order.{ "data": { "publicId", "payUrl", "qrUrl", "redirectSecret", ... } }. Send the customer to data.payUrl, or show data.qrUrl.redirectUrl is set, store data.redirectSecret with the order on the server.Ask the user to create a webhook in the dashboard (Webhooks) pointing at the new endpoint, then put its secret in APIPAY_WEBHOOK_SECRET. The endpoint:
event: "transaction.in". Match the order by data.amount and by data.content containing the order reference, case-insensitively (banks add text around it).payment_request.completed event: data.paymentRequest.publicId names the paid request and data.transaction is the transfer. Off by default; turn it on in the webhook's Events section. Fulfill from this event or transaction.in, not both.sandbox: true in production code paths, or routes them to test handling.const crypto = require("crypto");
function isValidSignature(rawBody, signature, secret) {
const expected = Buffer.from(crypto.createHmac("sha256", secret).update(rawBody).digest("hex"), "hex");
const received = Buffer.from(String(signature || ""), "hex");
return received.length === expected.length && crypto.timingSafeEqual(received, expected);
}
Full payload fields and examples in other languages: https://docs.apipay.vn/en/api/webhooks.md.
The redirect after payment carries ?data=<base64url JSON>&signature=<hex>. Verify the signature with that order's redirectSecret before showing "paid". ?status=cancel or ?status=expired has no signature and means not paid. The redirect is only for display: the verified webhook is the source of truth. Details: https://docs.apipay.vn/en/api/payment-requests.md.
POST https://app.apipay.vn/v1/payment-requests/<test_pr_...>/pay (no auth, no body). ApiPay sends the webhook to the sandbox webhooks.sandbox: true and liveTest: true.transactionId and a successful payment.Check in this order:
bankPublicIds), or not subscribed to that event (events).npx -y @apipay.vn/mcp): lets an AI assistant read and manage the merchant's ApiPay data with an API key. Setup: https://docs.apipay.vn/en/integrations/mcp.md.npm i -g apipay): log in, manage keys, banks, payment requests and webhooks from a terminal.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub apipay-vn/apipay --plugin apipayOther plugins' skills for the same job