> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.epaygames.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.epaygames.io/_mcp/server.

# Environments & Setup

## Base Hosts

Each API is called against its own host. In this collection, both hosts are represented as environment variables rather than hardcoded URLs, so you can point them at sandbox or production without editing individual requests.

| Variable                    | Used By          | Sandbox/Staging Value               |
| --------------------------- | ---------------- | ----------------------------------- |
| `{{payments_api_host}}`     | Payments API     | `api-stg.epaygames.io`              |
| `{{disbursement_api_host}}` | Disbursement API | `disbursement-api-stg.epaygames.io` |

All endpoint paths are appended to these hosts, e.g. in sandbox/staging:

```text
https://api-stg.epaygames.io/v1/biller/token/create
https://disbursement-api-stg.epaygames.io/v1/auth/token
```

Production hosts aren't published in this collection — use whatever host is assigned to you for production, and keep it separate from the sandbox/staging values above.

## Token Environment Variables

Both APIs automatically populate an environment variable with the bearer token once you successfully authenticate, so you don't need to manually copy/paste tokens between requests.

| Variable                 | Populated By                             | Used By                                                                                   |
| ------------------------ | ---------------------------------------- | ----------------------------------------------------------------------------------------- |
| `{{payments_api_token}}` | Payments API → `Create Token`            | Every other Payments API request (sent as `Authorization: Bearer {{payments_api_token}}`) |
| `{{token}}`              | Disbursement API → `Create Access Token` | Every other Disbursement API request                                                      |

This is handled by a post-response script attached to each token endpoint: on a successful response, it reads `data.token` from the JSON body and saves it to the environment automatically.

## Other Variables Used

| Variable           | Where It's Used                                | Purpose                                                  |
| ------------------ | ---------------------------------------------- | -------------------------------------------------------- |
| `{{randomString}}` | `Generate Transaction`, `Process Disbursement` | Auto-generates a unique `reference_no` for test requests |

## Sandbox/Staging Test Credentials

For trying out the **Payments API** in sandbox/staging, the collection ships with these test credentials:

| Field         | Value                                                              |
| ------------- | ------------------------------------------------------------------ |
| Username      | `test-merchant`                                                    |
| Password      | `p@ssw0rd01`                                                       |
| Signature Key | `9XAgVZzU4WhqrXA6jEvMtkF85j8wKZZhQ5RE2hsDPwa5rjPT7RpCmJceu8jNt4Wy` |

The **Disbursement API**'s `Create Access Token` request also uses the same `test-merchant` / `p@ssw0rd01` pair as its example body, so both APIs can be exercised end-to-end in sandbox with one set of credentials.

These are shared sandbox/staging credentials meant for trying out the collection. Use your own assigned production credentials before going live.

## Minimum Setup Checklist

#### Set your hosts

Set `payments_api_host` and/or `disbursement_api_host` in your environment (sandbox or production, as assigned to you).

#### Authenticate

Call the relevant token endpoint (`Create Token` for Payments, `Create Access Token` for Disbursement).

#### Confirm the token was saved

Check `payments_api_token` / `token` — if the response contained an `errors` key instead of `data`, authentication failed and no token will be saved.

#### Call the functional endpoints

Every other endpoint expects the saved token in the `Authorization` header.