Receive and verify Modern Treasury webhooks. Use when setting up Modern Treasury webhook handlers, debugging X-Signature verification (hex HMAC-SHA256 of the raw body), routing on the X-Topic header and event field, or handling payment operations events like payment_order.completed, payment_order.failed, expected_payment.reconciled and incoming_payment_detail.completed.
Capabilities
Verification (core)
X-Signature is the lowercase hex HMAC-SHA256 of the raw request body, keyed with your webhook key (Developers…
Request Headers and Body
The body is { "event": "completed", "data": { ...the object..
Common Event Types
Events are named per topic
Local Development
Getting started
Full instructionsExample command
Local Development
npx hookdeck-cli listen 3000 modern-treasury --path /webhooks/modern-treasuryInstructions: SKILL.mdv1.0.1
Modern Treasury Webhooks
When to Use This Skill
- How do I receive Modern Treasury webhooks?
- How do I verify a Modern Treasury webhook signature (
X-Signature)? - Why is my Modern Treasury webhook signature verification failing?
- How do I tell a
payment_orderevent from anexpected_paymentevent? (X-Topicheader plus bodyevent) - How do I handle
payment_order.completed,payment_order.failedorpayment_order.reconciled? - How do I avoid processing the same Modern Treasury webhook twice (
X-Webhook-ID)?
Verification (core)
X-Signature is the lowercase hex HMAC-SHA256 of the raw request body, keyed with your webhook key (Developers > Webhooks) used as a plain string. There is no timestamp and no prefix.
const crypto = require('crypto');
function verifySignature(rawBody, signature, webhookKey) {
if (!signature || !webhookKey) return false;
const expected = crypto.createHmac('sha256', webhookKey).update(rawBody).digest('hex');
const received = Buffer.from(signature.trim().toLowerCase());
const expectedBuf = Buffer.from(expected);
return received.length === expectedBuf.length &&
crypto.timingSafeEqual(received, expectedBuf);
}
// Node lowercases header names: read req.headers['x-signature'], not 'X-Signature'
Verify against the raw body bytes, before any JSON parsing. In Express use express.raw({ type: '*/*' }).
For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.
The official SDKs (modern-treasury on npm and PyPI) expose webhooks.validateSignature / validate_signature, but they compare with a plain ===/== and need a configured API client, so the examples verify manually with a timing-safe compare.
Request Headers and Body
| Header | Meaning |
|---|---|
X-Signature |
Hex HMAC-SHA256 of the body |
X-Topic |
Object category, e.g. payment_order, expected_payment |
X-Webhook-ID |
Unique per webhook, stable across retries (use for idempotency) |
X-Event-ID |
ID of the Event object |
X-Delivery-ID |
Changes on every delivery attempt |
X-Live-Mode |
true for live traffic, false for test |
The body is { "event": "completed", "data": { ...the object... } }. The event is the bare event name; combine it with X-Topic (payment_order.completed) to route.
Common Event Types
Events are named per topic. Verified against the Modern Treasury docs:
| Topic | Events |
|---|---|
payment_order |
created, updated, approved, denied, cancelled, begin_processing, finish_processing, acknowledged, confirmed, tentatively_reconciled, completed, reconciled, returned, failed, redrafted, reversed, held, resolved |
expected_payment |
created, reconciled, partially_reconciled, tentatively_reconciled, unreconciled, overdue, archived |
incoming_payment_detail |
created, tentatively_reconciled, completed, reconciled, returned, failed, return_failed, unreconciled |
transaction |
created, reconciled, updated |
return |
created, begin_processing, finish_processing, reconciled, completed, returned, failed, unreconciled |
reversal |
created, begin_processing, finish_processing, completed, failed, returned, unreconciled |
Other topics: balance_report, case, connection_legal_entity, decision, external_account, internal_account, ledger_account_settlement, ledger_transaction, legal_entity, user_onboarding. See references/overview.md for the full list.
Environment Variables
MODERN_TREASURY_WEBHOOK_KEY=your_webhook_key_here
Local Development
npx hookdeck-cli listen 3000 modern-treasury --path /webhooks/modern-treasury
No account required: the CLI creates a guest account on first run and provides a local tunnel plus a web UI for inspecting requests. Use the printed URL as your endpoint URL in Modern Treasury (sandbox accepts localhost URLs directly; production requires HTTPS). Use port 8000 for the FastAPI example.
Gotchas
- Raw body only. Re-serialized JSON changes the bytes and breaks the signature.
- Lowercase header lookup in Node. The Modern Treasury docs sample reads
req.headers['X-Signature'], which is alwaysundefined. - Respond within 5 seconds with a 2xx. Otherwise it is retried with exponential backoff, up to 15 attempts; the endpoint is then paused. Acknowledge fast and process async.
- Duplicates happen. Retries reuse
X-Webhook-ID, and a redrafted payment order can emit the same event again for the sameid. completedis notreconciled. Treat a payment order as fully settled atreconciled.- Same URL for live and test? Branch on
X-Live-Mode. - Ignore
X-Internal-Signature. It is for Modern Treasury's own use.
Reference Materials
- references/overview.md - Topics, events, headers and payload structure
- references/setup.md - Add a webhook endpoint and find the webhook key
- references/verification.md - Signature details, SDK notes, debugging
Recommended: webhook-handler-patterns
Install webhook-handler-patterns alongside this skill:
- Handler sequence
- Idempotency
- Error handling
- Retry logic
Related Skills
- stripe-webhooks - Stripe payment webhooks (HMAC-SHA256 with timestamp)
- adyen-webhooks - Adyen payment notifications
- checkout-com-webhooks - Checkout.com payment events
- airwallex-webhooks - Airwallex payments and payouts
- lithic-webhooks - Lithic card and payment events
- revolut-webhooks - Revolut Business events
- mollie-webhooks - Mollie payment webhooks
- bridge-api-webhooks - Bridge stablecoin and payment events
- webhook-handler-patterns - Idempotency, error handling, retry logic
- hookdeck-event-gateway - Production webhook infrastructure
Explore more skills
Browse all- Vercel WebhooksReceive and verify Vercel webhooks. Use when setting up Vercel webhook handlers, debugging signature verification, or…
- Supabase WebhooksReceive and verify Supabase webhooks. Use when setting up Supabase Database Webhooks (INSERT, UPDATE, DELETE table…
- Baselinker WebhooksReceive BaseLinker (Base.com) webhooks. Use when building a BaseLinker order or warehouse callback receiver, because…
- Svix WebhooksReceive and verify Svix webhooks (the Standard Webhooks scheme used by many providers). Use when setting up a Svix…
- Whatsapp WebhooksReceive and verify WhatsApp Business Platform (Cloud API) webhooks from Meta. Use when setting up WhatsApp webhook…
- Trigger Dev WebhooksReceive and verify Trigger.dev alert webhooks. Use when setting up Trigger.dev webhook handlers, debugging…
Security
Signing
SignedSLSA L2- Signed by
- skills-hub.ai distributor
- Method
- Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
- Key
- skills-hub-ed25519-2026-11
- Signed
Reviews (0)
More from Hookdeck
View source →Frequently asked questions about modern-treasury-webhooks
What does the modern-treasury-webhooks skill do?
Receive and verify Modern Treasury webhooks. Use when setting up Modern Treasury webhook handlers, debugging X-Signature verification (hex HMAC-SHA256 of the raw body), routing on the X-Topic header and event field, or handling payment operations events like payment_order.completed, payment_order.failed, expected_payment.reconciled and incoming_payment_detail.completed. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the modern-treasury-webhooks skill?
Run `npx @skills-hub-ai/cli install hookdeck-modern-treasury-webhooks` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/hookdeck-modern-treasury-webhooks/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does modern-treasury-webhooks work with?
modern-treasury-webhooks runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the modern-treasury-webhooks skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use modern-treasury-webhooks after installing it?
In Claude Code, type `/hookdeck-modern-treasury-webhooks` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the modern-treasury-webhooks skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.
Badge for your README
Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.
[](https://skills-hub.ai/skills/hookdeck-modern-treasury-webhooks)<a href="https://skills-hub.ai/skills/hookdeck-modern-treasury-webhooks"><img src="https://skills-hub.ai/api/badges/skill/hookdeck-modern-treasury-webhooks" alt="Install on Skills Hub"></a>More options in the badge docs.