Agent skill
Preczn Webhooks Skill
Receive and verify Preczn webhooks. Use when configuring Preczn webhook endpoints, debugging x-preczn-signature signatures, or handling transaction.approved, transaction.declined, merchant.created.
Install this skill
npx skills add hookdeck/webhook-skills --skill preczn-webhooks
Receive Preczn transaction and merchant notifications.
When to Use This Skill
- Configure a receiver for Preczn webhook deliveries.
- Diagnose
x-preczn-signatureverification failures. - Handle
transaction.approved,transaction.declined,merchant.created.
Setup
Create a Test-mode or Live-mode webhook subscription. Copy its signing secret from the create response or reveal it under Settings > Webhooks. Use the secret for that subscription and mode.
Set PRECZN_WEBHOOK_SECRET in the server environment. Read setup before enabling delivery.
Verification (core)
x-preczn-signature contains v1=<hex> over the raw body. Use HMAC-SHA256 with the secret's UTF-8 bytes. Verify the original bytes before parsing JSON. Validate the digest format, then compare equal-length buffers in constant time.
After extracting the documented digest and constructing message as described in verification, the comparison is:
const expected = crypto.createHmac('sha256', secret).update(message).digest();
if (digest.length !== 64 || !/^[0-9a-fA-F]{64}$/.test(digest)) return false;
const received = Buffer.from(digest, 'hex');
return received.length === expected.length && crypto.timingSafeEqual(received, expected);
No timestamp is included in the signed message. These examples do not invent an age check from unsigned fields.
Complete handlers and tests: Express, Next.js, FastAPI.
Event Handling
The envelope contains id, webhookId, eventType and data. Multiple comma-separated v1 signatures can be present during secret rotation; any matching v1 signature authenticates the request.
Respond with 2xx within five seconds. Preczn retries 5xx responses and transport failures up to three times, but does not retry 4xx. Deduplicate retries by id; dashboard resends have a new id, so also make the business operation idempotent.
Local Development
npx hookdeck-cli listen 3000 preczn --path /webhooks/preczn
Use port 8000 for FastAPI. The CLI provides a local tunnel and inspection UI; no account is required to start.