recharge-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Recharge (subscription commerce) webhooks. Use when setting up Recharge webhook handlers, debugging X-Recharge-Webhook-Signature or legacy…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Recharge Webhooks
When to Use This Skill
- How do I receive Recharge webhooks?
- How do I verify Recharge webhook signatures?
- Why is my
X-Recharge-Webhook-SignatureorX-Recharge-Hmac-Sha256verification failing? - How do I handle
charge/paid,charge/failed, orsubscription/cancelledevents? - How do I create a Recharge webhook subscription via the API?
Verification (core)
Every webhook delivery includes two signature schemes: a recommended timestamp-bound scheme (use this for all new integrations) and a legacy body-only scheme that remains supported.
Recommended: timestamp-bound scheme
Two headers are sent:
X-Recharge-Webhook-Timestamp— Unix epoch seconds (integer) at the time the request was signed.X-Recharge-Webhook-Signature— comma-separated key/value pairs in the formt=<epoch>,v1=<hex>(future schemes may addv2=…, so parse by key).
To verify:
- Parse
tandv1fromX-Recharge-Webhook-Signature(tmatches the timestamp header). - Reject if
abs(now - t) > 172800seconds (48 hours) — replay protection. - Compute HMAC-SHA-256, keyed by the API Client Secret, over
"<timestamp>.<payload_json>"— the timestamp, a literal dot, then the exact raw JSON bytes as transmitted (re-serializing breaks it). - Compare the hex digest to
v1with a constant-time comparison.
Node:
const crypto = require('crypto');
function verifyRechargeWebhookTimestamped(rawBody, signatureHeader, clientSecret) {
if (!signatureHeader) return false;
// Parse `t=<epoch>,v1=<hex>` by key.
const parts = Object.fromEntries(
signatureHeader.split(',').map((pair) => pair.split('=').map((s) => s.trim()))
);
const timestamp = parseInt(parts.t, 10);
if (!Number.isFinite(timestamp) || !parts.v1) return false;
// Reject deliveries outside the 48-hour window.
if (Math.abs(Math.floor(Date.now() / 1000) - timestamp) > 172800) return false;
// HMAC-SHA-256 over "<timestamp>.<raw body>", keyed by the client secret.
const digest = crypto
.createHmac('sha256', clientSecret)
.update(`${timestamp}.`)
.update(rawBody)
.digest('hex');
try {
return crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(parts.v1));
} catch {
return false; // length mismatch = invalid
}
}
Python:
import hashlib, hmac, time
def verify_recharge_webhook_timestamped(raw_body: bytes, signature_header: str, client_secret: str) -> bool:
if not signature_header:
return False
parts = dict(pair.partition("=")[::2] for pair in signature_header.split(","))
timestamp, signature = parts.get("t", ""), parts.get("v1", "")
if not timestamp.isdigit() or not signature:
return False
# Reject deliveries outside the 48-hour window.
if abs(int(time.time()) - int(timestamp)) > 172800:
return False
# HMAC-SHA-256 over "<timestamp>.<raw body>", keyed by the client secret.
digest = hmac.new(
client_secret.encode("utf-8"), f"{timestamp}.".encode("utf-8") + raw_body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(digest, signature)
Legacy: body-only scheme (X-Recharge-Hmac-Sha256)
For backward compatibility, every webhook also includes the legacy X-Recharge-Hmac-Sha256
header. Fall back to it only when the new header is absent.
The biggest gotcha: despite the header name, this is NOT a true HMAC. It is a plain
SHA-256 hash of the API Client Secret concatenated with the raw request body — secret first,
then body — hex-encoded. Use sha256(secret + rawBody), not hmac(secret, rawBody). Always hash
the raw body bytes; verification fails "even if one space is lost".
Node:
function verifyRechargeWebhookLegacy(rawBody, signatureHeader, clientSecret) {
if (!signatureHeader) return false;
// Plain SHA-256 of (clientSecret + rawBody), NOT HMAC. Secret is prepended.
const digest = crypto.createHash('sha256').update(clientSecret).update(rawBody).digest('hex');
try {
return crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(signatureHeader));
} catch {
return false; // length mismatch = invalid
}
}
Python:
def verify_recharge_webhook_legacy(raw_body: bytes, signature_header: str, client_secret: str) -> bool:
if not signature_header:
return False
# Plain SHA-256 of (client_secret + raw_body), NOT HMAC. Secret is prepended.
digest = hashlib.sha256(client_secret.encode("utf-8") + raw_body).hexdigest()
return hmac.compare_digest(digest, signature_header)
There is no official Recharge SDK for webhook verification (@rechargeapps/storefront-client covers
the Storefront API only), so verify manually as above.
Dispatching events
Recharge does not send a documented topic/action header. Payloads wrap the resource by a
top-level key — {"charge": {…}}, {"order": {…}}, {"subscription": {…}} — so dispatch on that
key. If yo
Установить recharge-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл recharge-webhooks?
Receive and verify Recharge (subscription commerce) webhooks. Use when setting up Recharge webhook handlers, debugging X-Recharge-Webhook-Signature or legacy X-Recharge-Hmac-Sha256 signature verification, or handling subscription events like charge/paid, charge/failed, subscription/created, subscription/cancelled, and order/created.
Как установить скилл recharge-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл recharge-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic