Webhooks
Receive events in real time and keep your integration in sync with Easyflow.
On this page
Webhooks are the safest and most reliable way to stay up to date. Instead of asking the API for changes, your server receives an HTTP request from Easyflow as soon as something happens, such as an order being paid or a subscription being canceled.
How it works
- You register the URL of an endpoint on your server with Easyflow and choose the events you want to receive.
- When one of those events happens, Easyflow sends a
POSTrequest to your URL with a JSON body. - Your server processes the event and answers with a
2xxstatus code.
Payload
Every delivery has the same envelope: the name of the event, when it was sent and its data.
{
"event": "order.paid",
"occurredAt": "2025-01-01T12:00:05.000Z",
"payload": {
"id": "1a3c5e7a-9c1e-4a5c-8e9a-1c3e5a7c0029",
"status": "paid",
"valueInCents": 4990,
"createdAt": "2025-01-01T12:00:00.000Z"
}
}| Field | Description |
|---|---|
event |
Name of the event, such as order.paid. |
occurredAt |
Date and time when the notification was sent, in UTC. |
payload |
Complete data of the resource at the moment of the event. |
The fields of payload depend on the type of the event. The example above is shortened. See the complete payloads below.
Event types
| Type | Prefix | Payload |
|---|---|---|
| Orders | order. |
Order events |
| Subscriptions | subscription. |
Subscription events |
| Subscription recurrences | subscriptionRecurrence. |
Recurrence events |
| Payments | payment. |
Payment events |
| Payment links | paymentLink. |
Payment link events |
| Commissions | commission. |
Commission events |
For example, order.paid is sent when an order is fully paid and subscription.canceled when a subscription is canceled. The webhook events page lists every event name.
| Group | Events |
|---|---|
| Payment links | paymentLink.created, paymentLink.updated, paymentLink.removed, paymentLink.published, paymentLink.unpublished, paymentLink.expired, paymentLink.canceled |
| Commissions | commission.created, commission.updated, commission.released |
Subscription and payment link events
subscription.deactivatedandsubscription.inactivatedboth leave the subscription with thestatusinactive, without canceling it.subscription.deactivatedis automatic: it is sent when a recurrence used all its retries without being paid.subscription.inactivatedis sent when the subscription is inactivated manually.- A recurrence is a billing cycle of the subscription, not a charge attempt. Its
idstays the same across the retries, each attempt adds an item topayments, andsubscriptionRecurrence.failedis sent for every attempt that fails. See Subscription cycles. - Only the first cycle, charged when the buyer subscribes, is an order with
order.paid. The following cycles create no order and sendsubscriptionRecurrence.*events. - Every
subscription.*event bringsorderId, the order of the subscription, andpaymentLinkId, the payment link that created it ornull. UseorderIdto match the subscription with its order. See Order and payment link of the subscription. - Every item of the
order.*events bringssubscription, with only theidof the subscription of the item, ornull.order.createdalways comes withnull, andorder.paidof the first cycle can also come withnull: thensubscription.createdbrings the link. See Subscription of the item. - On a payment link with
maxOrdersPerLink,paymentLink.canceledis sent when the limit is reached, and it can arrive before or afterorder.paid. Treat them as independent events. See the payment link events.
Receiving events
A minimal receiver in Node.js with Express:
import express from 'express';
const app = express();
app.post('/webhooks/easyflow', express.json(), (request, response) => {
const { event, payload } = request.body;
if (event === 'order.paid') {
markOrderAsPaid(payload.id);
}
response.sendStatus(200);
});
app.listen(3000);Best practices
- Answer quickly. Return a
2xxstatus as soon as you receive the event and do heavy work in the background. - Handle repeated deliveries. When your endpoint fails, the notification is kept in a queue and sent again later. Use the resource
idand its status to make your processing idempotent. - Check the current state. Compare the status in the payload with what you have stored, or fetch the resource from the API before taking irreversible actions.
- Protect your endpoint. A webhook configuration can include custom headers, such as an
Authorizationtoken, that are sent with every delivery. When your webhook has them, check them before trusting a request. When you read the configuration back, for example in a list of webhooks or in the details of a webhook or of a delivery log, the header values are shown as[REDACTED]. Only the standard headersAccept,Accept-Encoding,Content-Encoding,Content-Length,Content-TypeandUser-Agentkeep their values. Every delivery still sends the headers with their real values. - Use HTTPS. Your endpoint receives personal and financial data.