modem-pay-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Modem Pay webhooks. Use when setting up Modem Pay webhook handlers, debugging x-modem-signature (HMAC-SHA512) verification, or handling…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Modem Pay Webhooks
When to Use This Skill
- How do I receive Modem Pay webhooks?
- How do I verify the
x-modem-signatureheader? - How do I handle
charge.succeeded,payment_intent.createdortransfer.failedevents? - Why is my Modem Pay webhook signature verification failing?
- How do I test Modem Pay webhooks locally with
modempay listen?
Essential Code (USE THIS)
Modem Pay sends x-modem-signature: <hex>: the hex HMAC-SHA512 (128 characters, no sha512= prefix) of the request body, keyed with your webhook secret used as-is. There is no timestamp in the scheme.
Hash the raw body bytes. Modem Pay's docs say the signature covers the "exact request body" and warn against parsing the JSON and turning it back into a string, which changes spacing or key order. The raw body is what was signed, and it's what Hookdeck's Modem Pay source checks.
Verification (Node.js)
const crypto = require('crypto');
// rawBody: Buffer of the exact request bytes (express.raw({ type: '*/*' }), not express.json)
function verifyModemPay(rawBody, signatureHeader, secret) {
if (!secret || typeof signatureHeader !== 'string') return false;
const signature = signatureHeader.trim();
if (!/^[0-9a-fA-F]{128}$/.test(signature)) return false; // validate before comparing
const expected = Buffer.from(crypto.createHmac('sha512', secret).update(rawBody).digest('hex'));
const received = Buffer.from(signature.toLowerCase());
return received.length === expected.length && crypto.timingSafeEqual(received, expected);
}
Verification (Python)
import hashlib, hmac, re
def verify_modem_pay(raw_body: bytes, header, secret: str) -> bool:
if not secret or not header or not re.fullmatch(r"[0-9a-fA-F]{128}", header.strip()):
return False
expected = hmac.new(secret.encode(), raw_body, hashlib.sha512).hexdigest().encode()
return hmac.compare_digest(header.strip().lower().encode(), expected) # bytes, never str
Hex is compared case-insensitively. The examples answer 401 when the header is missing or empty, malformed, or doesn't match. Modem Pay's snippets answer 400; either works, because Modem Pay retries any non-2xx response.
Payments created with a callback_url send their events to that URL instead of your webhook, signed with a different key: the lowercase hex SHA-256 of your secret API key. See references/verification.md.
For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.
Event Shape
{
"event": "charge.succeeded",
"payload": { "id": "23419194-…", "type": "payment", "amount": 2500, "currency": "GMD",
"payment_method": "qmoney", "status": "completed", "test_mode": true, "…": "…" }
}
Every webhook has two fields: event, the name of what happened, and payload, the object it happened to. Verify first, then check that the body is an object, event is a string and payload is an object before reading into them.
Common Event Types
| Event | Description |
|---|---|
charge.succeeded |
The money is in; fulfil the order on this one |
charge.created / charge.failed / charge.cancelled / charge.refunded |
Rest of the payment lifecycle |
payment_intent.created / .cancelled / .expired / .restored |
Payment intent lifecycle |
transfer.succeeded / .failed / .reversed / .flagged / .queued / .cancelled |
Payout lifecycle |
customer.created / customer.updated / customer.deleted |
Customer lifecycle |
invoice.created / .updated / .deleted / .overdue |
Invoice lifecycle (invoice.overdue is live mode only) |
This is the list on Modem Pay's webhooks page. Its invoice pages also name paymentrequest.success for a paid invoice. The examples handle charge.succeeded, charge.failed, payment_intent.created, customer.created, transfer.succeeded and transfer.failed, and acknowledge (200) anything else. See references/overview.md.
Important Headers
| Header | Description |
|---|---|
x-modem-signature |
Hex HMAC-SHA512 of the raw body, keyed with the webhook secret |
Modem Pay's docs don't name a Content-Type or any other header, so the examples accept any content type (express.raw({ type: '*/*' }); Next.js request.arrayBuffer(); FastAPI await request.body()) and parse JSON only after verifying.
Delivery, Retries and Duplicates
If your endpoint doesn't reply with a 2xx, or times out, Modem Pay tries again up to 3 more times, 10 minutes apart. Every delivery and your server's response is listed under Developers > Webhooks > Events, where you can resend any event by hand. Answer 200 quickly and do slow work in a background job.
The body has no event or delivery ID. Modem Pay says payload.id stays the same across retries, but it's the charge's (or cu
Установить modem-pay-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл modem-pay-webhooks?
Receive and verify Modem Pay webhooks. Use when setting up Modem Pay webhook handlers, debugging x-modem-signature (HMAC-SHA512) verification, or handling charge, payment intent, payout (transfer), customer and invoice events from the Modem Pay payment gateway.
Как установить скилл modem-pay-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл modem-pay-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
gtm-enterprise-account-planning
Strategic account planning and execution for enterprise deals. Use when planning complex sales cycles, managing multiple stakeholders, applying MEDDICC…
от GitHubgtm-partnership-architecture
Build and scale partner ecosystems that drive revenue and platform adoption. Use when building partner programs from scratch, tiering partnerships, managing…
от GitHublanding-page-conversion-audit
Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review…
от GitHubpower-platform-architect
Use this skill when the user needs to transform business requirements, use case descriptions, or meeting transcripts into a technical Power Platform solution…
от GitHub