> 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/ko/getting-started/webhook-callback.md). Agents can also search and read this documentation through its [MCP server](https://docs.50spays.com/~gitbook/mcp).

# 웹훅

주문 수명 주기 콜백 — 엔벨로프, 헤더, 데모 규칙

주문 수명 주기 이벤트는 서명된 HTTPS 콜백으로 전달됩니다.

**웹훅**(콜백)은 주문 생성과 업데이트 정보를 전달하는 데 사용됩니다.

모든 웹훅은 다음 형식을 따릅니다:

**Method**

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

**Headers**

| 이름           | 값                                                                                   |
| ------------ | ----------------------------------------------------------------------------------- |
| Content-Type | `application/json`                                                                  |
| x-signature  | 요청의 디지털 서명 — [인증](https://docs.50spays.com/ko/getting-started/authentication.md) 참고 |
| x-timestamp  | 서버 시간 (Unix timestamp)                                                              |
| x-nonce      | 요청별 고유 nonce                                                                        |

**Body**

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

| 이름      | 타입     | 설명                                                                                           |
| ------- | ------ | -------------------------------------------------------------------------------------------- |
| type    | string | 웹훅 타입: `order`                                                                               |
| payload | object | 타입별 객체. `order`의 경우 [주문 정보](https://docs.50spays.com/ko/orders/order-info.md) 응답과 동일한 주문 데이터 |

### 데모 자동 주문 확정

**Demo** 환경(`https://api-demo.50spays.org`)에서는 주문 생성 후 약 **3분** 뒤 자동으로 완료됩니다.

**pay-in**과 **pay-out** 모두에 적용됩니다.

결과는 요청 금액의 **마지막 두 자리**에 따라 달라집니다:

| 금액 끝자리 | 결과       | 동작                 |
| ------ | -------- | ------------------ |
| `50`   | `FAILED` | 주문 거절              |
| `75`   | `PAID`   | 요청액보다 **10% 더** 지급 |
| `25`   | `PAID`   | 요청액보다 **10% 덜** 지급 |
| 그 외    | `PAID`   | 요청액 그대로 지급         |

{% hint style="info" %}
이 기능은 **staging**과 **dev**에서만 동작합니다.

**Production**에서는 절대 동작하지 않습니다. Production 주문은 실제 결제 게이트웨이만 처리합니다.
{% 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/ko/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.
