khipu-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Khipu webhooks. Use when setting up Khipu (Chilean bank-transfer payments) notify_url handlers, debugging x-khipu-signature verification…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Khipu Webhooks
When to Use This Skill
- How do I receive Khipu webhooks (the
notify_urlof a collection)? - How do I verify the
x-khipu-signatureheader (t=...,s=...)? - Why is my Khipu webhook signature verification failing?
- How do I handle a reconciled Khipu payment notification (
payment_id,amount,conciliation_date)?
Only notifications API version 3.0 is supported. Version 1.3 notifications aren't signed this way and fail verification.
Khipu sends one POST to the collection's notify_url when a payment is reconciled, for collections created with notify_api_version "3.0". The older 1.3 API sent only a notification_token and is not covered here. Khipu's API reference says it waits for an HTTP 200 and retries for up to two days if it doesn't get one, so answer 200 once the payment is recorded. No timeout or retry interval is documented.
Essential Code (USE THIS)
Khipu signs every delivery:
x-khipu-signature: t=1711965600393,s=rq08YUGSaWa1D0RAwhMnJTRHMNmY4ToCn2Gd6G9LaDg=
tis a Unix timestamp in milliseconds. Use it as the exact string from the header.sis standard padded base64 of HMAC-SHA256 over"<t>.<raw body>". The key is the merchant secret of the collecting account, as UTF-8 bytes (not decoded).- There is no event-name field or header. Today every POST is a reconciled payment; Khipu lists three more notification kinds as upcoming without saying how they will be told apart.
Verification (Node.js)
const crypto = require('crypto');
// rawBody: Buffer of the exact request bytes (express.raw({ type: '*/*' }), not express.json)
function verifyKhipu(rawBody, header, secret) {
if (!secret || !header) return false;
let t;
const sigs = [];
for (const item of header.split(',')) {
const i = item.indexOf('=');
const key = item.slice(0, i).trim(), value = item.slice(i + 1).trim();
if (key === 't' && t === undefined) t = value;
else if (key === 's') sigs.push(value);
}
if (!t) return false;
const expected = crypto.createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest('base64');
return sigs.some((s) => {
if (!/^[A-Za-z0-9+/]{43}=$/.test(s)) return false; // validate before comparing, never Buffer.from(s, 'base64')
const a = Buffer.from(s), b = Buffer.from(expected);
return a.length === b.length && crypto.timingSafeEqual(a, b);
});
}
Verification (Python)
import base64, hashlib, hmac, re
def verify_khipu(raw_body: bytes, header, secret: str) -> bool:
if not secret or not header:
return False
t, sigs = None, []
for item in header.split(","):
key, _, value = item.partition("=")
key, value = key.strip(), value.strip()
if key == "t" and t is None:
t = value
elif key == "s":
sigs.append(value)
if not t:
return False
digest = hmac.new(secret.encode(), t.encode() + b"." + raw_body, hashlib.sha256).digest()
expected = base64.b64encode(digest)
return any(
re.fullmatch(rb"[A-Za-z0-9+/]{43}=", s.encode()) and hmac.compare_digest(s.encode(), expected)
for s in sigs
)
Accept the delivery if any s= entry matches and ignore other keys. A missing header, no t=, a malformed signature or a mismatch gets 401.
Timestamp window is off by default. Hookdeck retries and replays resend the original t, so a fixed window would reject legitimate redeliveries. The examples offer an opt-in: set KHIPU_WEBHOOK_TOLERANCE_SECONDS to a positive number (t is milliseconds, the examples convert). Unset or 0 leaves it off. Use payment_id for idempotency instead.
For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.
Payload
| Field | Description |
|---|---|
payment_id |
Khipu payment identifier |
receiver_id |
Collecting account id |
subject, amount, discount, currency |
Payment details (amounts may arrive as numbers or strings) |
payer_name, payer_email, personal_identifier |
Payer details |
bank, bank_id, bank_account_number, payment_method |
How it was paid |
transaction_id, authorizer_operation_code |
Reconciliation references |
out_of_date_conciliation, conciliation_date |
Reconciliation info |
receipt_url |
PDF receipt |
See references/overview.md. Full reference: Khipu payment webhook.
Environment Variables
KHIPU_WEBHOOK_SECRET=your_merchant_secret # the collecting account's secret
KHIPU_WEBHOOK_TOLERANCE_SECONDS=0 # optional; a positive value opts in to the replay window
Local Development
# Start tunnel (no account needed)
npx hookdeck-cli listen 3000 khipu --path /webhooks/khipu
Reference Mater
Установить khipu-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл khipu-webhooks?
Receive and verify Khipu webhooks. Use when setting up Khipu (Chilean bank-transfer payments) notify_url handlers, debugging x-khipu-signature verification, or handling reconciled payment notifications from notifications API 3.0.
Как установить скилл khipu-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл khipu-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic