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

# Get Started

> Get API keys, run your first request, and reach first success quickly.

This page is designed for first success quickly:

1. install the SDK → 2) authenticate → 3) create an invoice → 4) observe status via REST or WebSockets.

## 1) Get API keys (dashboard)

Sign in to the Pepay Dashboard (login required) to create API keys:

<Card title="Pepay Dashboard Login" icon="key" href="https://pepay.io/sign-in">
  Create API keys for server-to-server integrations.
</Card>

You’ll see two key types in the dashboard:

* Merchant API keys: use `x-api-key` for `/api/v1/*` merchant endpoints (invoices, tokens, events).
* Commerce API keys: use `x-commerce-api-key` for `/api/commerce/*` endpoints (search, carts, checkout, orders).

If you need access or onboarding support, email `support@pepay.io`.

## 2) Install the SDK

```bash theme={null}
npm install pepay
```

## 3) Configure your environment variables

```bash theme={null}
export PEPAY_API_URL="https://api-beta.pepay.io"
export PEPAY_API_KEY="sk_live_..."  # Merchant API key (x-api-key)
```

Defaults used in these docs:

* Base URL: `https://api-beta.pepay.io`
* Dashboard login: `https://pepay.io/sign-in`

## 4) Create an invoice (server)

```ts theme={null}
import { Pepay } from 'pepay';

const pepay = new Pepay({
  apiKey: process.env.PEPAY_API_KEY!,
  baseUrl: process.env.PEPAY_API_URL ?? 'https://api-beta.pepay.io'
});

const invoice = await pepay.invoices.create({
  amount_usd: 49.99,
  description: 'Starter plan'
});

console.log(invoice);
```

Example response:

```json theme={null}
{
  "invoice_id": "550e8400-e29b-41d4-a716-446655440000",
  "payment_url": "https://<payment-iframe-host>/pay?session=pst_...&signature=sig_...",
  "expires_at": 1766322000,
  "session_token": "pst_...",
  "signature": "sig_...",
  "payment_session_headers": {
    "x-session-token": "pst_...",
    "x-signature": "sig_..."
  }
}
```

## 5) Observe status (REST)

```ts theme={null}
const status = await pepay.invoices.status(invoice.invoice_id);
console.log(status);
```

## 6) Observe events (WebSockets)

For realtime delivery, mint a short-lived `ws_token` server-to-server and connect to the merchant stream:

* Mint token: `POST /api/v1/ws/token`
* Connect: `wss://…/ws/merchant/events?token=<ws_token>`

Next: [Install](/sdk/install)
