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

## Before you start: your credentials

Once we set up your account, your credentials appear in the Aeris console under **Affiliate → Integration**. You'll use these five values throughout:

| Value               | What it's for                                                                                                                            |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `api_key`           | Identifies you. Goes in the `X-Merchant-Key` header on every server call. Looks like `mk_` followed by 32 characters.                    |
| `hmac_secret`       | Your signing key. **Shown once** — copy it into your secret manager right away. We can't recover it; if you lose it, generate a new one. |
| `advertiser_id`     | Your id for the tracking script (the `cb('init', …)` call).                                                                              |
| `s2s_endpoint_base` | The base URL for server calls, e.g. `https://realry.com/api/v1/direct`.                                                                  |
| `test_credential`   | Marks a **sandbox** key. Orders sent with a sandbox key run through the whole flow but never pay anyone — use it to test safely.         |

We give you a **sandbox** key first so you can test end to end, then a **live** key once you're ready.

***

## Quickstart

Three steps. Do them in order and the integration is done.

<Steps>
  <Step title="Add the tracking script to every page">
    Put this in the `<head>` of every page on your site:

    ```html theme={null}
    <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>
    ```

    On your **order-confirmation page**, also fire a `purchase` event:

    ```html theme={null}
    <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? Add `cb('config', { auto_spa_pageview: true });` once after `init`. To debug, add `?cb_debug=1` to any URL and watch the browser console, or run `cb('status')`.
  </Step>

  <Step title="Save the click id from the creator's link">
    When a shopper arrives from a creator, their URL carries a `cb_aev` value:

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

    That `cb_aev` is the **click id** — it's how we know which creator to credit. The tracking script saves it automatically, but you also need to **store it on the order** so your server can send it back in Step 3. (Do it yourself because the browser pixel can't always fire — but your server always can.)
  </Step>

  <Step title="Report the order from your server">
    The moment payment actually completes, have your server send a signed call. This is the call that credits the creator and settles commission:

    ```bash theme={null}
    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>

That's the whole integration. Don't want to build the signature by hand? Copy a ready-made helper for PHP, Node, Python, or curl from the [Reference](/integration/reference).

<Tip>
  Test everything with your **sandbox** key first, then switch to the live key.
</Tip>
