Skip to main content

Webhook Best Practices

1. Return 200 quickly

Process webhooks asynchronously. Return a 200 response immediately, then handle the event in a background job.

app.post('/webhooks/ikawaari', (req, res) => {
// Acknowledge immediately
res.status(200).json({ received: true });

// Process asynchronously
processEvent(req.body).catch(console.error);
});

2. Handle duplicate events

Webhooks may be delivered more than once. Use the event id to deduplicate:

async function processEvent(event) {
const alreadyProcessed = await db.events.findOne({ eventId: event.id });
if (alreadyProcessed) return;

await db.events.insert({ eventId: event.id, processedAt: new Date() });
// Handle the event...
}

3. Verify signatures

Always verify webhook signatures in production.

4. Handle event types you care about

Ignore events you don't need:

const relevantEvents = ['payment_intent.succeeded', 'payment_intent.payment_failed'];

if (!relevantEvents.includes(event.type)) {
return res.status(200).json({ received: true });
}

5. Use HTTPS

Always use HTTPS endpoints in production. Ikawaari will not deliver webhooks to HTTP URLs in live mode.

6. Monitor delivery

Check webhook delivery status in Developers → Webhooks → [endpoint] → Attempts in the dashboard.