Skip to content
Guides/Track payments

Get notified when money arrives

Cadmos can send a signed message to your server each time a payment reaches your wallet. That message is a webhook.

1. Check who sent the payment notice

Register your HTTPS webhook URL with Cadmos. Fetch the public signing addresses once and cache them. During a key rotation, the list can contain two addresses.

Show the request for signing addresses
curl --fail-with-body 'https://auth.cadmos.finance/v1/external-auth/webhook-signers'

2. Verify the message

Keep the original request bytes before parsing JSON. Verify the signature against those bytes and reject a timestamp more than five minutes from your clock. If the signer is unfamiliar, refresh the list once and verify again.

Show the signature verifier · Node.js and ethers 6

Pass the raw request buffer, lowercase HTTP headers, and cached signer addresses.

JavaScript
const { createHash } = require('crypto');
const { verifyMessage } = require('ethers');

// rawBody: the exact bytes received. signers: the addresses from GET /v1/external-auth/webhook-signers.
function verifyCadmosWebhook(rawBody, headers, signers) {
  const timestamp = headers['x-cadmos-timestamp'];
  if (!/^\d+$/.test(timestamp) || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  try {
    const digest = createHash('sha256').update(rawBody).digest('hex');
    const message = `${timestamp}.${JSON.parse(rawBody).id}.${digest}`;
    return signers.includes(verifyMessage(message, headers['x-cadmos-signature']));
  } catch {
    return false;
  }
}

3. Store the credit and check the order

After verification, save the settlement using its id as a unique key. Return a 2xx response after saving. If you already saved that ID, acknowledge the duplicate without adding another credit.

For a fixed-price order, use linkUuid to read the link and check paid. Cadmos retries failed deliveries for up to three days. You can also recover missed payments.

We use necessary cookies to run this site. With your permission, we also use analytics and advertising technologies to measure visits and downloads.