How to set up a webhook endpoint
1. Create the endpoint
Your endpoint must:- Accept
POSTrequests - Return
2xxwithin a reasonable time (we recommend < 5 seconds) - Process the raw request body (not parsed JSON) for signature validation
2. Register your URL in the dashboard
Go to your dashboard → Settings → Webhooks → Add endpoint. Copy the Webhook Secret shown — you’ll need it for signature validation.Signature validation
Every webhook request includes alyel-signature header:
The signature is computed as:
constructEvent() handles this automatically, including:
- Parsing the header
- Recomputing the signature
- Rejecting events older than 5 minutes (to prevent replay attacks)
- Using
timingSafeEqualto prevent timing attacks
Event types
payment.completed
Fired when a payment intent reaches COMPLETED status.
payment.failed
Fired when a payment attempt fails (e.g. insufficient balance, wrong OTP).
payment.expired
Fired when a payment intent passes its expiry time without being completed.
Idempotency
Webhooks may be delivered more than once. Design your handler to be idempotent — processing the same event twice should not cause double charges or duplicate fulfillments.Retries
If your endpoint returns a non-2xx status, Lyel Pay will retry the delivery. The retry schedule is:
After 4 failed retries, the event is marked as undelivered. You can manually replay events from your dashboard.