# 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.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cashramp.co/cashramp/cashramp-bot-api/webhook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
