> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryaeris.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

## 시작 전: credentials

당신의 계정을 설정하면 Aeris 콘솔의 **Affiliate → Integration** 에 credentials 가 나타납니다. 이 다섯 개 값을 전반에 걸쳐 사용합니다:

| Value               | 용도                                                                                  |
| ------------------- | ----------------------------------------------------------------------------------- |
| `api_key`           | 당신을 식별. 모든 server 호출의 `X-Merchant-Key` header 에 들어감. `mk_` + 32자리 형식.               |
| `hmac_secret`       | 서명 key. **한 번만 표시** — 바로 secret manager 에 복사해두세요. 복구 불가; 잃으면 새로 발급.                 |
| `advertiser_id`     | Tracking script (`cb('init', …)` 호출)용 id.                                           |
| `s2s_endpoint_base` | Server 호출의 base URL, 예: `https://realry.com/api/v1/direct`.                         |
| `test_credential`   | **Sandbox** key 표시. Sandbox key 로 보낸 주문은 전체 flow 를 통과하지만 실제 지급은 발생하지 않음 — 안전한 테스트용. |

먼저 **sandbox** key 로 end-to-end 테스트, 준비되면 **live** key 로 전환.

***

## Quickstart

세 단계. 순서대로 따라하면 integration 완료.

<Steps>
  <Step title="모든 페이지에 tracking script 추가">
    사이트 모든 페이지의 `<head>` 에 넣으세요:

    ```html theme={"dark"}
    <script async src="https://ads.realry.com/cb.js"></script>
    <script>
      window.cb = window.cb || function(){(window.cb.q=window.cb.q||[]).push(arguments)};
      cb('init', 'YOUR_ADVERTISER_ID');
      cb('event', 'page_view');
    </script>
    ```

    **주문 완료 페이지**에서는 `purchase` event 도 fire:

    ```html theme={"dark"}
    <script>
      cb('event', 'purchase', {
        transaction_id: 'ORDER_ID',
        value: 49900,
        currency: 'KRW',
        items: [{ item_id: 'sku-7', price: 49900, quantity: 1 }]
      });
    </script>
    ```

    Single-page checkout? `init` 다음에 `cb('config', { auto_spa_pageview: true });` 한 번 추가. Debug 하려면 URL 에 `?cb_debug=1` 붙여서 console 보거나 `cb('status')` 실행.
  </Step>

  <Step title="크리에이터 링크의 click id 저장">
    팄로워가 크리에이터 링크로 들어오면 URL 에 `cb_aev` 가 들어있습니다:

    ```text theme={"dark"}
    https://shop.example.com/products/123?cb_aev=ABC123
    ```

    `cb_aev` 가 **click id** — 어느 크리에이터에게 credit 을 줘야 하는지 이걸로 결정. Tracking script 가 자동으로 저장하지만, Step 3 에서 서버가 다시 보낼 수 있도록 **주문에 별도 저장**해두세요. (브라우저 pixel 은 항상 fire 되지 않을 수 있지만 서버는 항상 가능하니 직접 하는 것.)
  </Step>

  <Step title="서버에서 주문 report">
    결제가 실제로 완료되는 순간, 서버에서 signed call 을 보내세요. 이 호출이 크리에이터에게 credit 을 주고 commission 을 정산합니다:

    ```bash theme={"dark"}
    BASE="https://realry.com/api/v1/direct"
    API_KEY="mk_your_key"; SECRET="your_hmac_secret"
    TS=$(date +%s)
    BODY='{"merchant_order_id":"order-1","event_id":"evt-1","amount":49900,"currency":"KRW","cb_aev":"ABC123","product_name":"Silk Blouse"}'
    SIG=$(printf '%s' "${TS}${BODY}" | openssl dgst -sha256 -hmac "$SECRET" | sed 's/^.* //')

    curl -sS -X POST "$BASE/conversions" \\
      -H "X-Merchant-Key: $API_KEY" \\
      -H "X-Signature-Timestamp: $TS" \\
      -H "X-Signature: $SIG" \\
      -H "Content-Type: application/json" \\
      --data "$BODY"
    # → {"data":{"status":"CONFIRMED","net_amount":49900,...}}
    ```
  </Step>
</Steps>

이게 integration 전부. 서명을 직접 구현하기 싫으면 PHP, Node.js, Python, cURL helper 를 [Reference](/ko/integration/reference) 에서 복사해가세요.

<Tip>
  모든 것을 **sandbox** key 로 먼저 테스트, 그 다음 live key 로 전환.
</Tip>
