Wayout LogoDocumentation

Webhook

Receive real-time payment notifications via HTTP webhook


Introduction

If you run your own web application server, you can easily add real-time payment event processing with a webhook.

You can create one in the client area under Notifications -> Webhooks.

It's a simple form that takes two parameters:

Form

FieldDescription
URLThe URL to which we will send HTTP POST requests when payment events occur.
EventsThe types of events you want to receive. You can choose to receive all events, or only specific event types.

Events you can choose from include:

Event types

Event NameDescription
payment_detectedSent when a payment is detected but not yet confirmed, and the invoice status changes to "Confirming"
payment_confirmedSent when a payment is fully confirmed and the invoice status changes to "Paid"
payment_failedSent when a payment fails and the invoice status changes back to "Unpaid"

Message verification

After you create a webhook, you immediately receive a secret, unique to that webhook, which can be used in your application to verify that messages received are authentic.

Requests will be signed with a header called signature.

We employ HMAC-SHA512.

Code examples

const secret = 'SHARED_SECRET';

const body = req.body;
const receivedSignature = req.headers['signature'];

const computedSignature = crypto
  .createHmac('sha512', secret)
  .update(JSON.stringify(body))
  .digest('hex');

if (receivedSignature !== computedSignature) {
  return res.status(401).send('Unauthorized');
}

At payment event

When a qualifying event occurs, your webhooks will receive an HTTP POST request containing a JSON payload and a signature header which can be used to verify the authenticity of the message.

Example Event Payload

{
  "event": "payment_confirmed",
  "invoice_id": "12345",
  "status": "Paid",
  "payment_id": "6789"
}

Webhook Body Schema

FieldTypeDescription
invoice_idstringThe ID of the invoice.
statusstringThe status of the invoice. Possible values are "Paid", "Confirming", and "Failed".
eventstringThe type of event
payment_idstringThe ID of the payment triggering this event associated with the invoice.

Webhook request headers

FieldType
signaturestring
  • Your webhook should respond with a 200 - OK HTTP status code to acknowledge successful event handling.

  • If your webhook does not respond with a 200 status code, we will retry event delivery for up to 3 days, with an increasing delay between attempts.