klarna-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Klarna Notifications API webhooks. Use when creating signing keys (POST /v2/notification/signing-keys) and webhooks, verifying the…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Klarna Webhooks
Klarna's Notifications API sends signed webhooks for payment requests, payment transactions, disputes, partner accounts, settlements and Klarna Partner Portal events. It's used by Klarna Network Distribution partners, acquirers and Klarna Direct integrations. You create signing keys and webhooks through the API. (The older Klarna Payments and Checkout push and callback URLs are unsigned and aren't covered here.)
When to Use This Skill
- How do I receive Klarna webhooks?
- How do I verify
Klarna-Signature? - Is the signing key used as-is or decoded? (as-is, UTF-8 text)
- How do I rotate signing keys without dropping notifications?
- What should my endpoint respond? (a 2xx, quickly)
Verification (core)
From Klarna's webhook setup guide: "Apply HMAC-SHA256 to the raw HTTP request body with the corresponding signing key, then encode the digest as lowercase hexadecimal (64 characters). Do not use Base64."
| Header | Value |
|---|---|
Klarna-Signature |
Lowercase hex HMAC-SHA256 of the raw body (64 characters) |
Klarna-Signing-Key-Id |
Which signing key signed it |
The key is the signing_key that POST /v2/notification/signing-keys returned, used as a plain UTF-8 string. Klarna's own SAP Commerce plugin keys the HMAC with savedSigningKey.getBytes(StandardCharsets.UTF_8).
const crypto = require('crypto');
function verifyKlarnaSignature(rawBody, signature, signingKey) { // rawBody: exact bytes
const value = String(signature || '').trim();
if (!signingKey || !/^[0-9a-fA-F]{64}$/.test(value)) return false;
const expected = crypto.createHmac('sha256', signingKey).update(rawBody).digest();
return crypto.timingSafeEqual(Buffer.from(value, 'hex'), expected);
}
- Keys are shown once. "You will not be able to retrieve these keys again." Store each key with its ID.
- Rotation. Klarna recommends accepting the old and new keys in parallel while you switch. Up to 50 keys per account. With several keys, pick the one named by
Klarna-Signing-Key-Id(see references/verification.md). The examples hold one key. - Bad signatures. Klarna's guide says to reject them with
400. The examples use401. Either is a non-2xx. - Secret not set:
500.
For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.
Python uses hmac.new(signing_key.encode(), raw_body, hashlib.sha256), bytes.fromhex and hmac.compare_digest.
Hookdeck: the Klarna source type (KLARNA) verifies Klarna-Signature. Paste the signing_key as-is. One key per source: during a rotation, deliveries signed with the other key fail until you update it. Verification is optional on the source, and Hookdeck applies no timestamp window.
Payload
{
"metadata": {
"event_id": "b0e715e0-2ebd-462f-80f6-1366b4f9a4af",
"event_type": "payment.request.state-change.completed",
"event_version": "v2",
"occurred_at": "2025-02-28T12:52:57.577790899Z",
"product_instance_id": "krn:partner:product:test:5cadd30a-...",
"webhook_id": "krn:partner:global:notification:webhook:bc266feb-...",
"live": false
},
"payload": {
"payment_request_id": "krn:payment:eu1:request:552603c0-..."
}
}
metadata.event_id is stable across retries: store the event keyed on it, then acknowledge.
Event Categories
| Category | Examples |
|---|---|
| Payment Request | payment.request.state-change.submitted, .in-progress, .completed, .expired, .canceled, .declined |
| Payment Transaction | State changes on a payment transaction |
| Payment dispute | A dispute is initiated, escalated or resolved |
| Partner Account | A partner account changes status |
| Klarna Partner Portal | portal.user-access.created, portal.user-access.updated, portal.deep-link.created |
| Settlements | A payout is made or a settlement report is ready |
Subscribe with wildcards such as payment.request.* or portal.*.
Environment Variables
KLARNA_SIGNING_KEY=your-signing-key # signing_key from POST /v2/notification/signing-keys
Local Development
# Express / Next.js (use 8000 for FastAPI). No install or account required.
npx hookdeck-cli listen 3000 klarna --path /webhooks/klarna
Create a webhook with the printed URL (Hookdeck URLs use port 443, which Klarna requires), then trigger a simulated event in the test environment. See references/setup.md.
Reference Materials
- references/overview.md - Payload, events, acknowledgement rules, retries
- references/setup.md - Signing keys, webhooks, simulating events
- references/verification.md - The scheme, m
Установить klarna-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл klarna-webhooks?
Receive and verify Klarna Notifications API webhooks. Use when creating signing keys (POST /v2/notification/signing-keys) and webhooks, verifying the Klarna-Signature header (lowercase hex HMAC-SHA256 of the raw body keyed with the signing key), rotating keys, simulating webhooks in the test environment, or handling events like payment.request.state-change.completed, payment transaction, dispute and settlement events.
Как установить скилл klarna-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл klarna-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