Skip to content

Receive the job.paid webhook

Documents @snap4id-sdk/partner-api 1.0.0

When a job of yours is paid, Snap4ID can POST a signed job.paid event to your webhook URL (set at onboarding). It is optional, and useful whoever checks purchases: to record payments server-side and copy files from your backend.

{
"event_id": "3b494732-257b-5290-bd93-33a64be78a6f",
"type": "job.paid",
"job_id": "eu-6f1c2b9e-3d4a-4b8f-9c2e-1a7d5e3f0b42",
"payment_ref": "3b241101-e2bb-4255-8caf-4136c566a962",
"order_code": "7K3M9Q",
"paid_at": "2026-11-24T12:00:00.000Z"
}
import express from 'express';
// The RAW body: never let a JSON body parser touch this route (a re-serialised body does not verify).
app.post('/webhooks/snap4id', express.raw({ type: '*/*' }), async (req, res) => {
const result = await snap4id.verifyWebhook({ headers: req.headers, rawBody: req.body });
if (!result.ok) {
res.status(result.reason === 'keys_unavailable' ? 503 : 401).end(); // never 410 here
return;
}
if (await alreadyProcessed(result.event.event_id)) {
res.status(200).json({ duplicate: true });
return;
}
await markPaid(result.event.job_id, result.event.payment_ref);
await rememberProcessed(result.event.event_id);
res.status(200).end();
// then, e.g., snap4id.getJob(jobId) and copy the files
});

Without a client: createWebhookVerifier({ keysUrl: 'https://snap4.id/api/v1/partner/webhook-keys' }).

Result Answer Why
verified, new event_id process, then 2xx delivered
verified, event_id already processed 2xx, do nothing retries carry the same body and event_id
keys_unavailable 503 Snap4ID retries
any other failure 401 (or 400), never 410 410 drops a genuine event for good
you deliberately stop this event 410 the only way to stop retries
  • Delivery is at least once, retried with backoff for 72 hours after paid_at, each attempt with a fresh timestamp and signature but the same body. The 5-minute signature window is not a replay guard; event_id dedupe is (it is the UUID v5 of the job id).
  • Verification order: headers present, key id known, |now − x-timestamp| ≤ 5 min, Ed25519 signature over key_id\ntimestamp\nsha256(raw body), then a valid event. Keys are cached for an hour; an unknown key id refetches once (rotation), at most once a minute.
  • Never act on the body of a failed verification. A failing webhook never affects the job or the app’s delivery.
  • To stop deliveries when you offboard, ask Snap4ID to disable your webhook.

Wire contract: Partner API.