Introduction
This page describes what webhooks you can receive from our backend, and how to validate that the webhook is indeed coming from our backend.
URL restrictions
Please make sure that the URLs you create are globally routable. Don't use private IP addresses since they won't be reachable.
Our webhook system doesn't follow redirects, so if your backend responds with a 3xx response, it won't be followed. Make sure to process the webhooks at the original provided address.
Authentication
We use ED25519 to sign all our requests. You can use the following public key to verify our requests: MCowBQYDK2VwAyEAkXeRyk6QO8yGBkuX5eDiLvdHOWZ8QaiadNJhFYwZfAk=. The key is in SPKI DER format.
Each webhook should reach your endpoints with the following headers:
X-Webhook-Id- The unique ID of the webhook. Useful for deduplicating webhooks, idempotency, or simply debuggingX-Timestamp- The Unix UTC timestamp (milliseconds) measured on our backend when the webhook was sentX-Webhook-Signature- The ED25519 signature of the webhook request.
The signature is generated based on the components of the request:
X-Timestamp- HTTP method in uppercase format. This is going to be
POSTfor our webhooks. - Request path, excluding the query string:
/users, /transactions/send - Query string, if present. Including the
?symbol:?amount=5&status=pending. This is useful if the webhook URL you provided to our backend contains a query string for some reason - HTTP body
Example
So for example, you add a webhook URL https://backend.com/my-webhook?source=inv. The query string is to demonstrate how signatures act, usually it's quite unexpected to have a query string as part of a webhook URL but it is supported. If our backend sent you a webhook fro the checkoutCompleted event, the signature would be calculated as follows:
- timestamp =
1780011704561 - method =
POST - path =
/my-webhook - query =
?source=inv - body =
{"type":"checkoutCompleted","data":{"id":"123","externalId":"ORD10045","status":"paid"}}
Signature = sign(`1780011704561POST/my-webhook?source=inv{"type":"checkoutCompleted","data":{"id":"123","externalId":"ORD10045","status":"paid"}}`);The body is signed exactly as it is sent, byte for byte. Verify the signature against the raw body you received, before parsing it as JSON.
Example code
Below is an example verification process of our webhooks using Node.js, TypeScript, and Express.js. The gist lies in the verifySignature method.
import { createPublicKey, verify } from "crypto";
import express, { json, Request, Response } from "express";
import { URL } from "url";
const app = express();
const publicKey = createPublicKey({
key: Buffer.from(
"MCowBQYDK2VwAyEAkXeRyk6QO8yGBkuX5eDiLvdHOWZ8QaiadNJhFYwZfAk=",
"base64"
),
format: "der",
type: "spki",
});
function verifySignature(req: Request, body: Buffer) {
const timestamp = req.headers["x-timestamp"];
const signatureB64 = req.headers["x-webhook-signature"];
if (!signatureB64 || typeof signatureB64 !== "string") {
throw new Error("Signature is missing from the request");
}
// You can also validate the timestamp, for example to avoid old stray webhooks
if (!timestamp || typeof timestamp !== "string") {
throw new Error("Timestamp is missing from the request");
}
// Reconstruct the full URL
const host = req.headers["host"] ?? "";
const url = new URL(`${req.protocol}://${host}${req.originalUrl}`);
// Replicate the steps performed when generating the signature
const components = [timestamp, req.method, url.pathname, url.search].map(
Buffer.from
);
const valid = verify(
null,
Buffer.concat([...components, body]),
publicKey,
Buffer.from(signatureB64, "base64")
);
if (!valid) {
throw new Error("Invalid signature");
}
}
function webhookSignatureBodyVerifier(
req: Request,
res: Response,
buf: Buffer<ArrayBufferLike>
) {
try {
verifySignature(req, buf);
} catch (e) {
res.status(403).send({
error: (e as Error).message,
});
throw e;
}
}
app.post(
"/webhook",
json({
verify: webhookSignatureBodyVerifier,
}),
(req, res) => {
console.log(req.headers, req.body);
res.send({
ok: true,
});
}
);
app.listen(8000);Webhook types
Below are the type of webhooks our system sends. If you notice a type or a status enum that is not defined on this page, it can be located on a related API page.
checkoutCompleted
This webhook notification is sent when a checkout is paid and the funds are in your wallet.
{
type: "checkoutCompleted";
data: {
id: string;
externalId: string; // your order ID
status: "paid";
}
}checkoutExpired
This webhook notification is sent when a checkout is not paid within its 48 hours, or as soon as Interac tells us the buyer declined, which can be well before that. If Interac tells us nothing about the payment, it is sent 24 hours after expiresAt.
An expired checkout can still be paid if the payment reaches us late. You then
get checkoutCompleted after this webhook. Accept it and treat the order as
paid.
{
type: "checkoutExpired";
data: {
id: string;
externalId: string; // your order ID
status: "expired";
}
}checkoutFailed
This webhook notification is sent when a checkout's Interac request could not be made, or when there is still no Interac link 10 minutes after the checkout was created. Its externalId is free to try again.
{
type: "checkoutFailed";
data: {
id: string;
externalId: string; // your order ID
status: "failed";
}
}transactionCreated
This webhook notification is sent when a new transaction is created.
{
type: "transactionCreated";
data: {
id: string;
}
}transactionUpdated
This webhook notification is sent when a transaction status or details are updated.
{
type: "transactionUpdated";
data: {
id: string;
rejectionReason?: string | null;
status: TransactionStatusDto;
};
}feeTransactionCreated
This webhook notification is sent when a fee transaction is created.
{
type: "feeTransactionCreated";
data: {
id: string;
}
}secureEtransferCreated
This webhook notification is sent when a Secure E-Transfer transaction is created.
{
type: "secureEtransferCreated";
data: {
id: string;
}
}secureEtransferUpdated
This webhook notification is sent when a Secure E-Transfer transaction is updated.
{
type: "secureEtransferUpdated";
data: {
id: string;
lastModifiedAt: number;
status: SecureEtransferStatusDto;
}
}paymentLinkCompleted
This webhook notification is sent when a payment link is completed.
{
type: "paymentLinkCompleted";
data: {
id: string;
}
}paymentLinkExpired
This webhook notification is sent when a payment link expires. For a customer who proceeded to Interac, if Interac tells us nothing about the payment, it is sent 24 hours after their 48 hours to pay are up.
An expired payment link can still be paid if the payment reaches us late. You
then get paymentLinkCompleted after this webhook. Accept it and treat the
invoice as paid.
{
type: "paymentLinkExpired";
data: {
id: string;
}
}paymentLinkCanceled
This webhook notification is sent when a payment link is canceled.
{
type: "paymentLinkCanceled";
data: {
id: string;
}
}paymentLinkFailed
This webhook notification is sent when a payment link fails: a wrong email was entered 5 times, or its Interac request could not be made.
{
type: "paymentLinkFailed";
data: {
id: string;
}
}