# Webhooks

Accrue sends webhook events to your configured `webhook_url` whenever a P2P payment changes state. You set this URL on your API key.

## Event Payload

Every webhook is an HTTPS **POST** to your `webhook_url` with a JSON body shaped like:

| Field        | Type     | Description                                          |
| ------------ | -------- | ---------------------------------------------------- |
| `event_type` | `string` | Machine-readable name of the event (see list below). |
| `data`       | `object` | Event-specific payload.                              |

***

## Events

| Event                        | Description                              |
| ---------------------------- | ---------------------------------------- |
| `payment.assigned`           | A payment has been assigned to your bot. |
| `payment.paid`               | A payment has been marked as paid.       |
| `payment.canceled`           | A payment has been canceled.             |
| `p2p_payment.status.updated` | A P2P payment status has changed.        |

***

## Verifying Webhooks

Every request includes two headers for verification:

| Header                 | Description                                                                    |
| ---------------------- | ------------------------------------------------------------------------------ |
| `X-CASHRAMP-TOKEN`     | Your webhook token from the API key.                                           |
| `X-CASHRAMP-SIGNATURE` | HMAC-SHA256 signature of the raw request body, signed with your webhook token. |

Always verify both before processing the payload.

***

## Responding to Webhooks

{% hint style="danger" %}
Return **`200 OK` immediately**. Any non-2xx or timeout is treated as a delivery failure and the event will be retried.
{% endhint %}

Offload any heavy processing to a background job — keep your webhook handler fast.
