Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

nmi-webhooks

БесплатноЗапускает вложенные скриптыНе проверен

Receive and verify NMI (Network Merchants) webhooks. Use when setting up NMI webhook handlers, debugging Webhook-Signature verification, or handling…

hookdeckот hookdeck★ 104 звезды на GitHub

Об этом скилле

NMI Webhooks

When to Use This Skill

  • How do I receive NMI (Network Merchants) webhooks?
  • How do I verify the NMI Webhook-Signature header?
  • Why is my NMI webhook signature verification failing?
  • How do I handle transaction.sale.success, transaction.auth.success, transaction.refund.success, or transaction.void.success events?
  • What is the t= value in the NMI signature header — is it a timestamp?

How NMI Webhooks Work (Read This First)

NMI does not use the Standard Webhooks spec. Each delivery carries a single custom header:

Webhook-Signature: t=f3c1e9a2b7d84c15,s=9b7c...e10a

Two facts drive everything below:

  1. t is what NMI's sample calls a nonce. It is part of the signed content. NMI's docs don't say what it holds or whether it is a timestamp, and they document no replay/timestamp tolerance window, so do not try to reject "old" deliveries by parsing t as a Unix time.
  2. The signature signs "<nonce>.<raw_body>". You verify by computing HMAC-SHA256 over the nonce, a literal ., and the raw, unparsed request body, keyed with your signing key, hex-encoding it, and comparing (timing -safe) to the s value. Re-serializing the JSON breaks the HMAC.
NMI ──POST body + "Webhook-Signature: t=<nonce>,s=<hex>"──▶ your endpoint
                                                             │  parse t + s
                                                             │  hmac_sha256(key, t + "." + rawBody)
                                                             ▼
                                              timing-safe compare hex == s → 200

The payload envelope is { "event_id", "event_type", "event_body" }. The event_type is a dotted lowercase string like transaction.sale.success.

Verification (core)

const crypto = require('crypto');

// Header: "Webhook-Signature: t=<nonce>,s=<lowercase-hex-hmac>"
// NMI calls t a nonce; the signed content is `<nonce>.<rawBody>`.
function verifyNmiWebhook(rawBody, signatureHeader, signingKey) {
  const parts = {};
  for (const seg of String(signatureHeader || '').split(',')) {
    const i = seg.indexOf('=');
    if (i !== -1) parts[seg.slice(0, i).trim()] = seg.slice(i + 1).trim();
  }
  const { t: nonce, s: signature } = parts;
  if (!nonce || !signature || !signingKey) return false;

  const body = Buffer.isBuffer(rawBody) ? rawBody.toString('utf8') : rawBody;
  const expected = crypto
    .createHmac('sha256', signingKey)
    .update(`${nonce}.${body}`)
    .digest('hex');
  try {
    return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
  } catch {
    return false; // length mismatch = invalid
  }
}

There is no official NMI SDK, so verification is manual in every language. Always verify against the raw body — parse JSON only after the signature checks out.

For complete handlers with route wiring, event dispatch, and tests, see:

Common Event Types

NMI's Payment Gateway sends 36 events in six categories: transactions, check status, recurring, settlement, chargebacks and the Automatic Card Updater. Transaction event names are dotted lowercase transaction.<action>.<result>, where action is one of sale, auth, capture, void, refund, credit, or validate, and result is success, failure, or unknown.

Event Fires When Common Use Cases
transaction.sale.success A sale (auth + capture) is approved Fulfil order, send receipt
transaction.sale.failure A sale fails Notify customer, retry/dunning
transaction.auth.success An authorization is approved Reserve funds, hold order
transaction.capture.success A prior auth is captured Mark order paid, fulfil
transaction.void.success A transaction is voided Release hold, cancel order
transaction.refund.success A refund succeeds Reverse fulfilment, notify
transaction.credit.success A credit transaction succeeds Payout/adjustment bookkeeping
transaction.validate.success A validation transaction succeeds Save card on file
transaction.check.status.settle An electronic check settles Mark check payment final
recurring.subscription.add A recurring subscription is created Provision the plan
settlement.batch.complete A settlement batch completes Reconcile transaction_ids
chargeback.batch.complete A batch with chargebacks completes (if your processor reports them) Open disputes

The .failure and .unknown result variants exist for every transaction action. A .unknown result means the gateway has no final outcome: look the transaction up before fulfilling or charging again. See references/overview.md for the fu

Полный SKILL.md на GitHub

Установить nmi-webhooks в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/express/.env.exampleexamples/express/README.mdexamples/express/package.jsonexamples/express/src/index.jsexamples/fastapi/.env.exampleexamples/fastapi/README.mdexamples/fastapi/main.pyexamples/fastapi/requirements.txtexamples/fastapi/test_webhook.pyexamples/nextjs/.env.exampleexamples/nextjs/README.mdexamples/nextjs/app/webhooks/nmi/route.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

Что делает скилл nmi-webhooks?

Receive and verify NMI (Network Merchants) webhooks. Use when setting up NMI webhook handlers, debugging Webhook-Signature verification, or handling transaction events like transaction.sale.success, transaction.auth.success, transaction.refund.success, and transaction.void.success. Note: NMI does NOT use Standard Webhooks — the Webhook-Signature header is "t=<nonce>,s=<sig>" (comma-separated), where NMI's sample calls t a nonce, and the signature is HMAC-SHA256 over "<nonce>.<raw_body>", lowercase hex.

Как установить скилл nmi-webhooks?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл nmi-webhooks запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить nmi-webhooks с