Agent skill

NextPay Webhooks Skill

Receive and verify NextPay (NextAPI) webhooks, delivered via Svix. Use when setting up NextPay webhook handlers, debugging svix-signature verification, or handling events like v2.payment_intent.succeeded, payout_request.processed, payout.failed, and deposit.confirmed.

Install this skill

npx skills add hookdeck/webhook-skills --skill nextpay-webhooks


NextPay's NextAPI is a Philippine payments API for collections (QRPH, cards, payment intents), payouts and platform wallets. It delivers webhooks through Svix, which implements Standard Webhooks. Every delivery is an HTTP POST with a JSON body and three signature headers: svix-id, svix-timestamp, and svix-signature. The body has one of two shapes: v2.* payment events are {"event": ..., "payload": ...}, while payout and platform events are {"type": ..., "data": ...}. Read the name as event.event || event.type.

When to Use This Skill

  • How do I receive NextPay webhooks?
  • How do I verify NextPay webhook signatures (svix-signature)?
  • How do I handle v2.payment_intent.succeeded or payout_request.processed events?
  • How do I react to payout.failed, deposit.confirmed or legal_entity.verification_status_changed?
  • Why is my NextPay webhook signature verification failing, or rejecting Hookdeck retries?

Verification (core)

Signed content is {svix-id}.{svix-timestamp}.{raw body}. Svix signs it with HMAC-SHA256 using the base64-decoded secret (the part after whsec_), base64-encodes the result, and sends one or more space-separated v1,<signature> entries. Use the official svix library, which compares in constant time. Read the svix-* headers, and when svix-id is absent fall back to the webhook-* headers (webhook-id, webhook-timestamp, webhook-signature).

import { Webhook } from 'svix'; // svix 2.x is ESM-only

const prefix = req.headers['svix-id'] ? 'svix' : 'webhook';
const id = req.headers[`${prefix}-id`];
const timestamp = req.headers[`${prefix}-timestamp`];
const signature = req.headers[`${prefix}-signature`];
// rawBody: the raw Buffer/string, never re-serialized JSON
new Webhook(process.env.NEXTPAY_WEBHOOK_SECRET).verify(rawBody, {
  'svix-id': id, 'svix-timestamp': timestamp, 'svix-signature': signature,
  'webhook-id': id, 'webhook-timestamp': timestamp, 'webhook-signature': signature,
}); // throws on a bad signature or a timestamp outside the window
const event = JSON.parse(rawBody.toString('utf8')); // parse only after verify passes
from svix.webhooks import Webhook, WebhookVerificationError

wh = Webhook(os.environ["NEXTPAY_WEBHOOK_SECRET"])  # "whsec_..."
wh.verify(raw_body, {"svix-id": id, "svix-timestamp": ts, "svix-signature": sig,
                     "webhook-id": id, "webhook-timestamp": ts, "webhook-signature": sig})

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

The signing secret is per webhook, starts with whsec_, and is returned once as secret in the response to POST /v2/webhooks. Keep the full whsec_... value in NEXTPAY_WEBHOOK_SECRET (NextPay's own guides call the variable NEXTAPI_WEBHOOK_SECRET; the name is your choice). Handlers fail closed: with the variable unset they return 500 instead of accepting anything.

Hookdeck retries and replays hit the 5-minute window

The svix library always enforces a fixed 5-minute timestamp window, and it can't be configured. Hookdeck retries and replays resend the original svix-timestamp, so the library rejects any retry or replay that happens more than 5 minutes after the original delivery. If you verify behind Hookdeck (or replay old events), use the manual verifier in references/verification.md, where the window can be dropped or widened. Deduplicate on svix-id (or the event id) instead of relying on the timestamp.

Common Event Types

16 events are documented (the list may not be exhaustive). The examples handle all of these:

EventBody shapeTriggered When
v2.payment_intent.succeededevent + payloadPayment received and settled
v2.payment_intent.canceledevent + payloadA payment intent was cancelled
v2.payment_instrument.usedevent + payloadA single-use Funding Method instrument was used
v2.payment_instrument.payment_receivedevent + payloadAn incoming Funding Method payment arrived
v2.payment_instrument.payment_settledevent + payloadThat incoming payment cleared
payout_request.creation_failedtype + dataA payout request failed to create
payout_request.queuedtype + dataA payout request is queued for settlement
payout_request.queue_failedtype + dataA payout request failed to queue
payout_request.processedtype + dataA payout request is fully processed
payout.succeededtype + dataAn individual payout was delivered
payout.failedtype + dataAn individual payout failed
payout.processedtype + dataAn individual payout finished processing
payout.processing_failedtype + dataAn individual payout failed during processing
deposit.confirmedtype + dataAn inbound deposit was confirmed on an account
direct_transfer.receivedtype + dataAn account received a direct transfer
legal_entity.verification_status_changedtype + dataA merchant KYC/compliance status changed

See references/overview.md for the body shapes and delivery rules.

Environment Variables

# Signing secret returned once by POST /v2/webhooks (Svix format, starts with whsec_)
NEXTPAY_WEBHOOK_SECRET=whsec_xxxxx

Local Development

# Start tunnel (no account needed)
npx hookdeck-cli listen 3000 nextpay --path /webhooks/nextpay

Register the tunnel URL with POST /v2/webhooks (an events list selects what you receive), and store the returned secret. See references/setup.md.

Reference Materials


Repository

hookdeck/webhook-skills

v0.1.0 · MIT · Updated Nov 16, 2026

View on GitHub →