Skip to main content
A webhook is how Locus tells your server that a checkout was paid or expired. Verify every webhook before you fulfill an order, and use browser callbacks only to update the page.

How it works

1

Set a webhook URL

Set webhookUrl when you create the session. The response returns a whsec_ secret for verifying signatures.
2

Verify the signature

Check X-Signature-256 against the raw request body. Reject requests with a missing or invalid signature.
3

Fulfill once

Match the paid session to your order, verify the amount, and fulfill it only once.

Events

Each event includes the session ID, amount, currency, payment transaction hash, payer address, payment time, and the metadata you set on the session. The event name and session ID are also sent in the X-Webhook-Event and X-Session-Id headers.

Verify the signature

verify-webhook.ts
Pass the raw request body as payload, the X-Signature-256 header as signature, and your whsec_ secret as secret.

Next steps

Integration example

Create a session with a webhook URL.

Payment Router

Verify external wallet payments on-chain.