When the payment is confirmed and the funds have settled into your wallet, Settlx sends a POST request to the webhookUrl you provided.Always verify the signature before processing.
You must use express.raw() (not express.json()) for the webhook route. Signature verification requires the raw request body bytes — parsing it to JSON first will break the HMAC.
function handleEvent(event) { switch (event.event) { case 'invoice.settled': { const { orderId } = event.data.invoice.metadata; const netAmount = event.data.settlement.netAmount; const currency = event.data.settlement.currency; // ✅ Funds are in your wallet — fulfill the order fulfillOrder(orderId, netAmount, currency); break; } case 'invoice.expired': { // Customer did not pay in time — cancel the order break; } default: // Log any other events for visibility console.log('Settlx event:', event.event); }}
Only fulfill the order on invoice.settled. This is the only event that guarantees the funds are in your wallet.