> For the complete documentation index, see [llms.txt](https://docs.50spays.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.50spays.com/getting-started/webhook-callback.md). Agents can also search and read this documentation through its [MCP server](https://docs.50spays.com/~gitbook/mcp).

# Webhooks

Order lifecycle callbacks — envelope, headers, demo rules

Order lifecycle events are delivered as signed HTTPS callbacks.

**Webhooks**, also known as **callbacks**, are used to deliver information about the creation and updates of an order.

All webhooks follow this format:

**Method**

<mark style="color:green;">`POST`</mark>

**Headers**

| Name         | Value                                                                                                                                                  |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Content-Type | `application/json`                                                                                                                                     |
| x-signature  | <p>Digital Signature of the Request<br><a href="https://docs.50spays.com/getting-started.md#digital-signature">How is the signature generated?</a></p> |
| x-timestamp  | Server time (Unix timestamp)                                                                                                                           |
| x-nonce      | Unique request nonce                                                                                                                                   |

**Body**

```json
{
    "type": "order",
    "payload": {
        ....
    },
}
```

<table><thead><tr><th width="263">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>string</td><td>Webhook Type:<br><code>order</code></td></tr><tr><td>payload</td><td>object</td><td><p>An object specific to the particular webhook type.</p><p>For the order type, it will contain order information identical to the response from the corresponding method <code>Order Info</code></p></td></tr></tbody></table>

### Automatic Order Confirmation on Demo

On **demo** (`https://api-demo.50spays.org`), orders are automatically completed about 3 **minutes after they are created**.

This works for both **pay-in** and **pay-out** orders.

The result depends on the **last two digits of the requested amount**:

| Amount ends with | Result   | What happens                                       |
| ---------------- | -------- | -------------------------------------------------- |
| `50`             | `FAILED` | The order is declined                              |
| `75`             | `PAID`   | The order is paid with **10% more** than requested |
| `25`             | `PAID`   | The order is paid with **10% less** than requested |
| Any other digits | `PAID`   | The exact requested amount is paid                 |

#### Examples

`1050, 2450` → `FAILED`

`1075, 5475` → `PAID` with 10% overpayment

`1025, 6225` → `PAID` with 10% underpayment

`1000, 5000` → `PAID` with the exact amount

`1234, 67843` → `PAID` with the exact amount

{% hint style="info" %}
This feature works only on **staging** and **dev**.

It **never works in production**. Production orders are processed only by the real payment gateway.
{% endhint %}


---

# 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.50spays.com/getting-started/webhook-callback.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.
