paypal-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify PayPal webhooks. Use when setting up PayPal webhook handlers, debugging certificate-based signature verification, or handling payment…
от hookdeck★ 104 звезды на GitHubОб этом скилле
PayPal Webhooks
When to Use This Skill
- Setting up PayPal webhook handlers
- Debugging PayPal signature verification failures (RSA-SHA256 with cert)
- Understanding PayPal event types like
PAYMENT.CAPTURE.COMPLETED - Handling payment, subscription, refund, or checkout events
- Choosing between PayPal's postback verify API and offline cert verification
How PayPal Webhooks Differ From Most Providers
PayPal does not use HMAC with a shared secret. Instead, each webhook is
signed with PayPal's private key, and you verify it with the matching public
certificate delivered per request via the paypal-cert-url header. The
algorithm is RSA-SHA256 ("SHA256withRSA").
Two valid verification paths:
- Postback (no crypto needed) — POST the captured headers, your
webhook_id, and the rawwebhook_eventbody to PayPal's/v1/notifications/verify-webhook-signatureendpoint. Requires an OAuth access token. PayPal returns{ "verification_status": "SUCCESS" }. - Offline self-verify (recommended for low-latency / no extra OAuth call) —
Fetch the cert from
paypal-cert-url(cache it; validate the host ends with.paypal.com), build the messagetransmissionId|transmissionTime|webhookId|crc32(rawBody), and verify the base64 signature against the cert's public key using RSA-SHA256.
The examples in this skill use the offline approach because it is testable without OAuth and avoids an extra API call per webhook. The postback path is documented in references/verification.md.
Essential Code (USE THIS)
Required Request Headers
| Header | Purpose |
|---|---|
paypal-transmission-id |
Unique webhook transmission ID |
paypal-transmission-time |
ISO 8601 timestamp of transmission |
paypal-transmission-sig |
Base64-encoded RSA-SHA256 signature |
paypal-cert-url |
URL of the public cert (must be a *.paypal.com host) |
paypal-auth-algo |
Signing algorithm, e.g. SHA256withRSA |
Signed Message Format
<transmissionId>|<transmissionTime>|<webhookId>|<crc32(rawBody)>
crc32(rawBody) is the standard CRC-32 of the raw HTTP body as an unsigned
decimal integer. webhookId is the ID of the webhook registered in your
PayPal app (env var PAYPAL_WEBHOOK_ID).
Express Webhook Handler
const express = require('express');
const crypto = require('crypto');
const zlib = require('zlib');
const https = require('https');
const app = express();
const certCache = new Map();
function fetchCert(certUrl) {
// SECURITY: Only trust certs served from paypal.com
const host = new URL(certUrl).hostname;
if (host !== 'paypal.com' && !host.endsWith('.paypal.com')) {
return Promise.reject(new Error('Cert URL host is not paypal.com'));
}
if (certCache.has(certUrl)) return Promise.resolve(certCache.get(certUrl));
return new Promise((resolve, reject) => {
https.get(certUrl, (res) => {
let data = '';
res.on('data', (c) => (data += c));
res.on('end', () => { certCache.set(certUrl, data); resolve(data); });
}).on('error', reject);
});
}
async function verifyPayPalWebhook(headers, rawBody, webhookId) {
const transmissionId = headers['paypal-transmission-id'];
const transmissionTime = headers['paypal-transmission-time'];
const transmissionSig = headers['paypal-transmission-sig'];
const certUrl = headers['paypal-cert-url'];
if (!transmissionId || !transmissionTime || !transmissionSig || !certUrl) {
return false;
}
const crc = zlib.crc32(rawBody);
const message = `${transmissionId}|${transmissionTime}|${webhookId}|${crc}`;
const cert = await fetchCert(certUrl);
const verifier = crypto.createVerify('SHA256');
verifier.update(message);
verifier.end();
try {
return verifier.verify(cert, transmissionSig, 'base64');
} catch {
return false;
}
}
// CRITICAL: express.raw() — PayPal verification needs the raw body for CRC32
app.post('/webhooks/paypal',
express.raw({ type: 'application/json' }),
async (req, res) => {
const ok = await verifyPayPalWebhook(
req.headers,
req.body,
process.env.PAYPAL_WEBHOOK_ID
);
if (!ok) return res.status(400).send('Invalid signature');
const event = JSON.parse(req.body.toString('utf8'));
switch (event.event_type) {
case 'PAYMENT.CAPTURE.COMPLETED':
console.log('Capture completed:', event.resource.id);
break;
case 'PAYMENT.CAPTURE.REFUNDED':
console.log('Refund issued:', event.resource.id);
break;
case 'BILLING.SUBSCRIPTION.CREATED':
console.log('Subscription created:', event.resource.id);
break;
case 'CHECKOUT.ORDER.APPROVED':
console.log('Order approved:', event.resource.id);
break;
default:
console.log('Unhandled event:', event.event_type);
}
res.json({ received: true });
}
);
FastAPI Webhook Handler
import os, zlib, base6
Установить paypal-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл paypal-webhooks?
Receive and verify PayPal webhooks. Use when setting up PayPal webhook handlers, debugging certificate-based signature verification, or handling payment events like PAYMENT.CAPTURE.COMPLETED, PAYMENT.SALE.COMPLETED, BILLING.SUBSCRIPTION.CREATED, or CHECKOUT.ORDER.APPROVED.
Как установить скилл paypal-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл paypal-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