Command Palette

Search for a command to run...

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

pine-labs-webhooks

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

Receive and verify Pine Labs Online (Plural by Pine Labs) webhooks. Use when setting up Pine Labs webhook handlers, debugging Standard Webhooks signature…

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

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

Pine Labs Webhooks

Pine Labs Online (Plural by Pine Labs) is an Indian payment gateway. It sends webhooks for orders, payments, refunds, card tokens, subscriptions, customers, payouts and cross-border settlement.

When to Use This Skill

  • How do I receive Pine Labs webhooks?
  • How do I verify a Pine Labs webhook signature (webhook-signature)?
  • Why does Pine Labs signature verification fail with the standardwebhooks or svix library?
  • How do I handle ORDER_PROCESSED, PAYMENT_FAILED or REFUND_PROCESSED events?
  • How do I handle SUBSCRIPTION_CHARGED or payout-transaction-success?
  • Why am I processing the same Pine Labs event twice, or getting events out of order?

Verification (core)

Pine Labs uses the Standard Webhooks headers. Verification is mandatory per Pine Labs' docs.

Header Value
webhook-id Event ID. Same when the webhook is resent
webhook-timestamp Unix seconds when the event was triggered
webhook-signature Space-delimited list of v1,<base64> signatures

Signed content is {webhook-id}.{webhook-timestamp}.{raw body}, HMAC-SHA256, base64. The key is the secret key from the Pine Labs dashboard as raw UTF-8 bytes. There is no whsec_ prefix and nothing to base64-decode. Pine Labs' docs say to base64-encode the key and decode it again before use, which cancels out.

Hookdeck's configuration alert reads exactly: "Paste the secret key exactly as shown in the Pine Labs dashboard, without adding a whsec_ prefix." Put the secret in PINE_LABS_WEBHOOK_SECRET the same way.

import crypto from 'node:crypto';

// rawBody: the exact bytes received (express.raw() / request.text()), NOT re-serialised JSON.
// toleranceSec = 0 (default) skips the timestamp window, because Hookdeck retries and replays
// keep the original webhook-timestamp. A positive value opts in.
function verifyPineLabsWebhook(rawBody, { id, timestamp, signature }, secret, toleranceSec = 0) {
  if (!id || !signature || !/^[1-9][0-9]*$/.test(timestamp ?? '')) throw new Error('Missing or malformed headers');
  if (toleranceSec > 0 && Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceSec) {
    throw new Error('Timestamp outside tolerance');
  }
  const key = secret.startsWith('whsec_')
    ? Buffer.from(secret.slice(6), 'base64') // only if the secret itself starts with whsec_
    : Buffer.from(secret, 'utf8');           // Pine Labs: the secret as-is
  if (key.length === 0) throw new Error('Empty signing key');
  const expected = crypto.createHmac('sha256', key).update(`${id}.${timestamp}.`).update(rawBody).digest();
  const ok = signature.split(' ').some((entry) => {
    const [version, sig] = entry.split(',');
    const given = Buffer.from(sig ?? '', 'base64');
    return version === 'v1' && given.length === expected.length && crypto.timingSafeEqual(given, expected);
  });
  if (!ok) throw new Error('Invalid signature');
  return JSON.parse(rawBody.toString('utf8'));
}

Header fallback: read the webhook-* headers and, when webhook-id is absent, use the svix-id, svix-timestamp and svix-signature headers instead. The examples do this and test it.

Why not the standardwebhooks or svix libraries? They base64-decode the secret, so they compute the wrong key for Pine Labs' raw string secret. They also enforce a 5-minute timestamp window, which rejects Hookdeck retries and replays (they keep the original timestamp). The examples verify by hand and make the window opt-in with PINE_LABS_WEBHOOK_TOLERANCE_SECONDS (default 0).

The Python version is in references/verification.md.

For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.

Payload Shape, Retries and Ordering

Order, payment, refund, customer, token and subscription events are { "event_type": "...", "data": { ... } }. Payout events (and the Pay by Points order examples) use camelCase eventType with camelCase data fields, so read event_type ?? eventType.

{ "event_type": "ORDER_PROCESSED",
  "data": { "order_id": "v1-240909084141-aa-O2oJwd", "status": "PROCESSED",
            "order_amount": { "value": 200, "currency": "INR" } } }
  • Reply 2XX within 5 seconds. Anything else is retried: immediately, then after 5 seconds, 5 minutes, 30 minutes, 2 hours, 5 hours and twice more at 10 hours. (The webhooks overview page says "up to three times", which conflicts with the retry policy page.)
  • Order is not guaranteed. ORDER_PROCESSED can arrive before ORDER_AUTHORIZED. Don't build a state machine on arrival order, and use the Get Order API when in doubt.
  • Deduplicate on webhook-id, which stays the same when an event is resent.

Common Event Types

Pine Labs documents 30 event types (the list may n

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

Установить pine-labs-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/pine-labs/route.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

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

Receive and verify Pine Labs Online (Plural by Pine Labs) webhooks. Use when setting up Pine Labs webhook handlers, debugging Standard Webhooks signature verification (webhook-id, webhook-timestamp, webhook-signature, secret key used as raw UTF-8 bytes), or handling events like ORDER_PROCESSED, PAYMENT_FAILED, REFUND_PROCESSED, SUBSCRIPTION_CHARGED, TOKEN_ACTIVATED and payout-transaction-success.

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

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

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

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

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

Сравнить pine-labs-webhooks с