M2Square

Webhooks

Receive signed notifications for asynchronous money movement and review events.

Webhooks are the source of truth for final state transitions.

Event delivery

M2Square sends events to configured HTTPS endpoints. Return 2xx only after durable storage.

Signature verification

import crypto from 'node:crypto';

export function verifyWebhook(rawBody: string, signature: string, secret: string) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(rawBody)
    .digest('hex');

  return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}

Common event types

EventWhen it fires
payin.completedA pay-in is available in your balance.
payout.failedA payout could not be delivered.
settlement.completedA settlement reached the destination rail.
compliance.review_requiredSentra review is required before the transaction can proceed.
liquidity.quote_expiredA reserved quote can no longer be used.

Retry handling

Webhook processing must be idempotent. Store event.id, ignore duplicates, and replay internal jobs from your own durable queue.

On this page