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

# Quickstart

> Create a merchant account, create a charge, and get paid by an AI agent, end to end in about 10 minutes.

# Quickstart

In this guide you will:

1. Create a **merchant account** and get an API key.
2. Create a **charge** for \$2.00.
3. Have an **agent pay it** from its Payzor wallet.
4. Watch the money land in your merchant balance.

All you need: a running Payzor API (local or remote) and `curl`.

> Before you start: ask the Payzor operator (or your own console) for:
>
> * the base URL, e.g. `http://localhost:3040`
> * a **console session** so you can register your business, and
> * an **agent API key** (`pz_sk_...`) to simulate your customer's agent.

## 1. Register your business

Merchant registration happens from a logged-in console session. Log in via the console UI (or your existing JWT flow) and call:

```bash theme={null}
curl -X POST https://your-payzor-host/merchants \
  -H "Authorization: Bearer <CONSOLE_JWT>" \
  -H "Content-Type: application/json" \
  -d '{"name": "Acme Digital Goods"}'
```

Response: **save the API key now, it is shown only once**:

```json theme={null}
{
  "merchantId": "mch_c8fdac10d39c0c4d",
  "apiKey": "sk_mch_3dc34f4326fa081f02b1e552a91b4696bb541572cbe89b23"
}
```

<Warning>
  The `sk_mch_...` key is stored hashed. If you lose it, issue a new merchant. Treat it like a password.
</Warning>

## 2. Create a charge

A charge is an intention to collect: "this customer owes me \$2.00". Amounts are integer **USD cents**.

```bash theme={null}
curl -X POST https://your-payzor-host/merchant/charges \
  -H "Authorization: Bearer sk_mch_..." \
  -H "Content-Type: application/json" \
  -d '{"amountUsdCents": 200, "description": "API credits pack"}'
```

Response:

```json theme={null}
{
  "chargeId": "chg_834e692669a3f8ad",
  "merchantId": "mch_c8fdac10d39c0c4d",
  "amountMinor": 200,
  "currency": "USD",
  "description": "API credits pack",
  "status": "pending",
  ...
}
```

Keep the `chargeId`; that is what gets paid.

## 3. Let the agent pay

Your customer's agent pays from its Payzor wallet using *its* key. The request goes through the agent's [Policy Engine](/concepts/policy-engine) automatically:

```bash theme={null}
curl -X POST https://your-payzor-host/charges/chg_834e692669a3f8ad/pay \
  -H "Authorization: Bearer pz_sk_agent_key..."
```

Three possible outcomes:

<ResponseField name="paid: true" type="success">
  Money moved instantly. You get the settled charge back with a `reference`.
</ResponseField>

<ResponseField name="pendingApproval: true" type="warning">
  The amount exceeded the agent's human-approval threshold. Nothing has been charged yet; a human must approve. Your webhook `approval.required` fires at the same time.
</ResponseField>

<ResponseField name="{ error }" type="error">
  The policy blocked it (limit, category not allowed, insufficient balance). The agent spent nothing.
</ResponseField>

## 4. Confirm the money arrived

```bash theme={null}
curl https://your-payzor-host/merchant/me \
  -H "Authorization: Bearer sk_mch_..."
```

```json theme={null}
{
  "merchant": {
    "id": "mch_c8fdac10d39c0c4d",
    "name": "Acme Digital Goods",
    "balanceMinor": 200,
    "currency": "USD",
    "payoutAddress": null
  }
}
```

That's it: an autonomous agent just paid you, within rules a human defined.

## What happened behind the scenes

<Tip>
  Every step above emitted events. If you had registered a webhook endpoint first (one `POST`), you would have received `charge.created`, `payment.succeeded`, and `charge.succeeded`, each signed with HMAC-SHA256. See [Webhooks](/guides/webhooks).
</Tip>

## Where to go next

<CardGroup cols={2}>
  <Card title="Get paid repeatedly" icon="repeat" href="/guides/recurring-billing">
    Use PayLinks to pre-authorize a budget once, then charge against it all month.
  </Card>

  <Card title="Full API reference" icon="book" href="/api-reference/merchants">
    Every endpoint, parameter, and response field.
  </Card>
</CardGroup>
