ncode-webhook-handler
Installation
SKILL.md
Webhook Handler Template
When building webhook endpoints, ALWAYS follow this pattern. Webhooks that skip steps = broken payments.
The 5-Step Pattern (applies to ALL providers)
// app/api/webhooks/[provider]/route.ts
export async function POST(req: Request) {
// 1. VERIFY SIGNATURE (never skip)
const body = await req.text();
const signature = req.headers.get('webhook-signature');
if (!verifySignature(body, signature, process.env.WEBHOOK_SECRET)) {
return new Response('Invalid signature', { status: 401 });
}
// 2. PARSE EVENT
const event = JSON.parse(body);