paymob-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Paymob webhook callbacks (transaction and card token callbacks). Use when setting up Paymob webhook handlers, debugging HMAC-SHA512…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Paymob Webhooks
When to Use This Skill
- How do I receive Paymob webhooks (transaction and card token callbacks)?
- How do I verify a Paymob HMAC signature?
- Why is my Paymob HMAC verification failing?
- How do I tell if a Paymob transaction succeeded, was refunded, or voided?
- Understanding the difference between the Transaction Processed Callback (POST) and Transaction Response Callback (GET)
Verification (core)
Paymob does not use Standard Webhooks, and it does not sign the raw body.
It computes HMAC-SHA512 over the values of a fixed, ordered list of keys
from obj, joined with no separator, hex-encodes it, and sends the result as
the hmac query parameter (?hmac=<hex>). Use the HMAC secret from your
Paymob dashboard (Settings > Developers > API Keys).
The key list depends on the callback's type, and both types arrive at the
same URL:
TRANSACTION(20 keys):amount_cents,created_at,currency,error_occured,has_parent_transaction,id,integration_id,is_3d_secure,is_auth,is_capture,is_refunded,is_standalone_payment,is_voided,order.id,owner,pending,source_data.pan,source_data.sub_type,source_data.type,success.TOKEN(8 keys, card token callback when a customer saves a card):card_subtype,created_at,email,id,masked_pan,merchant_id,order_id,token.
Node:
const crypto = require('crypto');
const HMAC_FIELDS = {
TRANSACTION: [
'amount_cents', 'created_at', 'currency', 'error_occured', 'has_parent_transaction',
'id', 'integration_id', 'is_3d_secure', 'is_auth', 'is_capture', 'is_refunded',
'is_standalone_payment', 'is_voided', 'order.id', 'owner', 'pending',
'source_data.pan', 'source_data.sub_type', 'source_data.type', 'success',
],
TOKEN: [
'card_subtype', 'created_at', 'email', 'id', 'masked_pan', 'merchant_id',
'order_id', 'token',
],
};
// body = parsed JSON ({ type, obj }); hmacParam = req.query.hmac
function verifyPaymobHmac(body, hmacParam, secret) {
const fields = HMAC_FIELDS[body.type];
if (!fields || !body.obj || !hmacParam) return false;
const signed = fields.map((f) => {
const v = f.split('.').reduce((o, k) => (o == null ? undefined : o[k]), body.obj);
return v == null ? '' : String(v); // booleans become "true"/"false"
}).join('');
const expected = crypto.createHmac('sha512', secret).update(signed).digest('hex');
const a = Buffer.from(expected);
const b = Buffer.from(String(hmacParam).toLowerCase());
return a.length === b.length && crypto.timingSafeEqual(a, b);
}
Python:
import hmac, hashlib
HMAC_FIELDS = {
"TRANSACTION": [
"amount_cents", "created_at", "currency", "error_occured", "has_parent_transaction",
"id", "integration_id", "is_3d_secure", "is_auth", "is_capture", "is_refunded",
"is_standalone_payment", "is_voided", "order.id", "owner", "pending",
"source_data.pan", "source_data.sub_type", "source_data.type", "success",
],
"TOKEN": [
"card_subtype", "created_at", "email", "id", "masked_pan", "merchant_id",
"order_id", "token",
],
}
def _value(obj: dict, path: str) -> str:
for key in path.split("."):
obj = obj.get(key) if isinstance(obj, dict) else None
if obj is True:
return "true" # not Python's "True"
if obj is False:
return "false"
return "" if obj is None else str(obj)
def verify_paymob_hmac(body: dict, hmac_param: str, secret: str) -> bool:
fields = HMAC_FIELDS.get(body.get("type"))
if not fields or not body.get("obj") or not hmac_param:
return False
signed = "".join(_value(body["obj"], f) for f in fields)
expected = hmac.new(secret.encode(), signed.encode(), hashlib.sha512).hexdigest()
return hmac.compare_digest(expected, hmac_param.lower())
Paymob's HMAC pages print a worked example for each list (the concatenated string and its digest), so test your code against them.
For complete handlers with route wiring, state dispatch, and tests, see:
Callback Types & Transaction States
The processed-callback URL receives two type values:
TRANSACTION: when a transaction succeeds or is declined, and again after an action on it (refund, void, capture). There's no event name for the outcome: read the booleans onobj.TOKEN: when a customer saves a card. Storeobj.tokenagainstobj.order_id.
Fields on a TRANSACTION |
Transaction state |
|---|---|
success: true |
Payment succeeded |
success: false, pending: false |
Declined |
success: false, pending: true |
Pending (OTP page, kiosk reference or cash collection) |
success: true, is_auth: true, is_capture: false |
Authorized (funds held, not captured) |
| `is_capture |
Установить paymob-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл paymob-webhooks?
Receive and verify Paymob webhook callbacks (transaction and card token callbacks). Use when setting up Paymob webhook handlers, debugging HMAC-SHA512 signature verification, or handling payment transaction states like success, refund, void, and auth/capture from the Transaction Processed Callback.
Как установить скилл paymob-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл paymob-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