Kyren Pay sends webhook notifications for the following event types.
Event Types
| Event | Description | Trigger |
|---|
order.paid | A payment has been confirmed | Customer completes checkout |
Event Object Structure
All webhook events share the same top-level structure:
{
"id": "evt_abc123",
"type": "order.paid",
"created_at": 1736932500000,
"data": {
// Event-specific data
}
}
| Field | Type | Description |
|---|
id | string | Unique event identifier (use for deduplication) |
type | string | The event type |
created_at | integer | Unix timestamp in milliseconds |
data | object | Event-specific payload |
order.paid
Sent when a customer successfully completes a payment.
{
"id": "evt_abc123",
"type": "order.paid",
"created_at": 1736932500000,
"data": {
"order_id": "order_def456",
"product_id": "prod_abc123",
"customer_email": "customer@example.com",
"amount": "9.99",
"currency": "USD",
"net_amount": "9.29",
"paid_at": 1736932500000,
"metadata": { "user_id": "u_123" }
}
}
| Field | Type | Description |
|---|
order_id | string | The order ID |
product_id | string | The product that was purchased |
customer_email | string | Customer’s email address |
amount | string | Total payment amount |
currency | string | Three-letter currency code |
net_amount | string | Amount after fees |
paid_at | integer | When the payment was confirmed (Unix timestamp in milliseconds) |
metadata | object | null | The metadata you passed when creating the checkout session |
This is the most important event. Use it to fulfill orders — for example, adding credits to a user’s account.
Handling Events
Here’s how to handle webhook events in your endpoint:
app.post('/webhooks/kyren', (req, res) => {
// ... verify signature first ...
const event = JSON.parse(req.body.toString());
switch (event.type) {
case 'order.paid':
handleOrderPaid(event.data);
break;
default:
console.log(`Unhandled event: ${event.type}`);
}
res.status(200).send('OK');
});