> For the complete documentation index, see [llms.txt](https://docs.damisa.xyz/AkjkmImZjoUgeLkiUdam/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.damisa.xyz/AkjkmImZjoUgeLkiUdam/developer-guides/webhooks.md). Agents can also search and read this documentation through its [MCP server](https://docs.damisa.xyz/AkjkmImZjoUgeLkiUdam/~gitbook/mcp).

# Webhooks

Set up webhook endpoints, subscribe to events, and verify signed deliveries from Damisa.

Webhooks let Damisa notify your service when something happens in your account — a payout is created, a payment request is completed, a contact's verification status changes, and more. Damisa sends an HTTPS `POST` to a URL you provide, with a signed JSON payload.

This page covers how to set up endpoints, the events you can subscribe to, and how to verify deliveries. The exact payload schema for each event is documented in the [**API Reference**](https://docs.damisa.xyz/AkjkmImZjoUgeLkiUdam/developer-guides/api-reference.md) under [**Webhooks Events**](https://docs.damisa.xyz/AkjkmImZjoUgeLkiUdam/developer-guides/api-reference/webhooks/webhook-events.md).

### How to set up a webhook

Webhooks are managed from the Damisa Portal.

#### **Open the Developers section**

1. Log in to the Damisa Portal.
2. Click the **user profile icon** in the top right and select **Developers** from the menu.
3. Switch to the **Webhooks** tab.

<figure><img src="https://829585684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TOkwwAxAnNqhyOVY5J5%2Fuploads%2FDQODCwCwCVZm4THeabp1%2Fdevelopers-menu.png?alt=media&amp;token=46c91c3a-59b7-461f-8203-104dffa4bdd9" alt="Webhooks tab in the Developers section"><figcaption></figcaption></figure>

#### **Add a new webhook**

1. Click **Add Webhook**.
2. Fill in:
   * **URL** — the public HTTPS endpoint that will receive the events (e.g. `https://example.com/damisa/webhook`). HTTP is not allowed.
   * **Events** — the event types you want to subscribe to (see below).
   * **Description** *(optional)* — a short note for your own reference.
3. Click **Add Webhook**.

<figure><img src="https://829585684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TOkwwAxAnNqhyOVY5J5%2Fuploads%2FrlKmPRYxqn2YSks2JZQZ%2Fadd-webhook.png?alt=media&amp;token=088b8593-9fe5-41c3-bb9d-3c40114fdb8f" alt="Add webhook form"><figcaption></figcaption></figure>

#### **Copy your signing secret**

Open the webhook from the list to reveal its **secret**. You'll use this secret to verify that incoming requests genuinely come from Damisa (see [Authorizing the request](#authorizing-the-request-signature-verification) below).

Treat the secret like a password — store it in your secret manager and never log it.

You can register multiple webhooks per organization — for example a production endpoint and a staging endpoint — and each one can subscribe to a different mix of events.

### Available event types

| Event                                 | Triggered when                                            |
| ------------------------------------- | --------------------------------------------------------- |
| `payout_created`                      | A new payout is created                                   |
| `payment_request_created`             | A new payment request is created                          |
| `payment_request_completed`           | A payment request has been fully paid                     |
| `transaction_created`                 | A transaction is recorded against your organization       |
| `transaction_updated`                 | A transaction's status changes                            |
| `contact_created`                     | A new contact is added to your contact book               |
| `contact_verification_status_updated` | A contact's verification status changes (e.g. `VERIFIED`) |

The full payload shape for each event is in the [API Reference](https://docs.damisa.xyz/AkjkmImZjoUgeLkiUdam/developer-guides/api-reference/webhooks/webhook-events.md).

### Request format

Damisa sends a `POST` request with a JSON body and the following headers:

| Header                | Description                                                |
| --------------------- | ---------------------------------------------------------- |
| `Content-Type`        | Always `application/json`                                  |
| `X-Webhook-Id`        | Unique UUID of this delivery (also mirrored in the body)   |
| `X-Webhook-Timestamp` | Unix timestamp (seconds) when the event was dispatched     |
| `X-Webhook-Signature` | HMAC-SHA256 signature, prefixed with `sha256=` (see below) |

Body shape:

```json
{
  "id": "c0dcd3e1-b727-4bdb-aaec-79f043e64cbe",
  "type": "payout_created",
  "createdAt": "2026-05-05T08:50:03.227Z",
  "data": { "...": "event-specific payload" }
}
```

### Authorizing the request (signature verification)

Each webhook is signed with the secret shown on its detail page in the Portal. Your endpoint should verify every delivery before trusting the payload — otherwise anyone who knows the URL could forge events.

The signature is computed as:

```
HMAC_SHA256(secret, "<X-Webhook-Timestamp>.<raw_request_body>")
```

…and sent as `X-Webhook-Signature: sha256=<hex>`.

#### Node.js example

```ts
import { createHmac, timingSafeEqual } from 'node:crypto';

export function isValidSignature(
  rawBody: string,
  timestamp: string,
  signatureHeader: string,
  secret: string,
): boolean {
  const expected = createHmac('sha256', secret)
    .update(`${timestamp}.${rawBody}`)
    .digest('hex');

  const received = signatureHeader.replace(/^sha256=/, '');

  const a = Buffer.from(expected, 'hex');
  const b = Buffer.from(received, 'hex');

  return a.length === b.length && timingSafeEqual(a, b);
}
```

> Use the **raw** request body (the bytes as received) — not a re-serialized JSON object. Re-serialization can change whitespace or key order and the signature will no longer match.

For extra safety, also reject deliveries whose `X-Webhook-Timestamp` is more than a few minutes old to mitigate replay attacks.

### Responses, retries and timeouts

* Damisa expects a **2xx** response (typically `200`) within **30 seconds**.
* If your endpoint returns a non-2xx status, times out, or is unreachable, the delivery is retried up to **3 attempts total** with exponential backoff (initial 5s, doubling).
* After the final failed attempt, the delivery is marked failed and is **not** retried again. For critical events, reconcile periodically by polling the relevant API endpoints.
* Each delivery has a unique `X-Webhook-Id`. Use it to **deduplicate** on your side — occasional duplicate deliveries are normal and your handler should be idempotent.

### Best practices

* **Verify the signature** on every request. Reject anything that fails.
* **Respond quickly** — return `200` as soon as you've persisted the event, then process it asynchronously. Long-running work in the request handler is the most common cause of timeouts and unwanted retries.
* **Use HTTPS** with a valid certificate. Self-signed certificates are not supported.
* **Deduplicate** on `X-Webhook-Id`.
* Subscribe only to the events you actually use — fewer events means a cleaner audit trail and lower load on your endpoint.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.damisa.xyz/AkjkmImZjoUgeLkiUdam/developer-guides/webhooks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
