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

# Crypto Payment Gateway

> Accept crypto with hosted checkout or deposit addresses that settle to you.

The Crypto Payment Gateway lets you take crypto payments that settle to your Rach
balance. Use a **hosted checkout** (Rach renders the pay page) or drive your own UI with
**deposit addresses**. Authenticate with your Payments API key (`X-API-Key`).

<Info>
  Base URL: `https://api.rach.finance/api/v1/` · Auth: `X-API-Key`
</Info>

## Create a checkout

<ParamField body="amount" type="number" required>Amount to charge.</ParamField>
<ParamField body="currency" type="string" required>e.g. `USD`, `NGN`.</ParamField>
<ParamField body="reference" type="string">Your unique order reference for reconciliation.</ParamField>
<ParamField body="customer_email" type="string">Buyer email for the receipt.</ParamField>
<ParamField body="callback_url" type="string">Where Rach POSTs the webhook on settlement.</ParamField>
<ParamField body="payment_method" type="string">`crypto`.</ParamField>
<ParamField body="metadata" type="object">Any key/values you want echoed back.</ParamField>

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.rach.finance/api/v1/checkout/create \
    -H "X-API-Key: $RACH_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "amount": 50,
      "currency": "USD",
      "reference": "order_1001",
      "customer_email": "buyer@example.com",
      "callback_url": "https://yourapp.com/webhooks/rach",
      "payment_method": "crypto",
      "metadata": { "cart_id": "9f3" }
    }'
  ```

  ```js Node theme={null}
  const res = await fetch("https://api.rach.finance/api/v1/checkout/create", {
    method: "POST",
    headers: { "X-API-Key": process.env.RACH_KEY, "Content-Type": "application/json" },
    body: JSON.stringify({
      amount: 50, currency: "USD", reference: "order_1001",
      customer_email: "buyer@example.com",
      callback_url: "https://yourapp.com/webhooks/rach",
      payment_method: "crypto",
    }),
  });
  const session = await res.json();
  // redirect the customer to session.payment_url
  ```

  ```python Python theme={null}
  import requests, os
  session = requests.post(
      "https://api.rach.finance/api/v1/checkout/create",
      headers={"X-API-Key": os.environ["RACH_KEY"]},
      json={
          "amount": 50, "currency": "USD", "reference": "order_1001",
          "customer_email": "buyer@example.com",
          "callback_url": "https://yourapp.com/webhooks/rach",
          "payment_method": "crypto",
      },
  ).json()
  print(session["payment_url"])
  ```
</CodeGroup>

```json Response theme={null}
{
  "session_id": "cs_1a2b3c",
  "payment_url": "https://api.rach.finance/pay/1a2b3c",
  "amount": 50,
  "currency": "USD",
  "status": "pending",
  "expires_at": "2026-08-14T13:00:00Z"
}
```

Redirect the customer to `payment_url`. They pick a coin/network and pay.

## Verify a payment

Poll the session (or rely on the [webhook](/guides/webhooks)):

```bash theme={null}
curl https://api.rach.finance/api/v1/checkout/verify/cs_1a2b3c \
  -H "X-API-Key: $RACH_KEY"
```

```json Response theme={null}
{
  "session_id": "cs_1a2b3c",
  "status": "paid",
  "amount": 50,
  "currency": "USD",
  "reference": "order_1001",
  "paid_at": "2026-08-14T12:41:00Z"
}
```

`status` is one of `pending`, `paid`, `expired`, `failed`.

## Full lifecycle

<Steps>
  <Step title="Create session">Send `amount`, `currency`, a unique `reference`, and a `callback_url`.</Step>
  <Step title="Customer pays">Redirect to `payment_url`; Rach handles coin/network selection.</Step>
  <Step title="Confirmation">Rach watches the chain and marks the session `paid`.</Step>
  <Step title="Webhook + settlement">Funds land in your balance and Rach POSTs your `callback_url`.</Step>
</Steps>

## Other endpoints

| Endpoint                  | Purpose                                                       |
| ------------------------- | ------------------------------------------------------------- |
| `GET /checkout/list`      | Your checkout sessions (paginated)                            |
| `GET /checkout/stats`     | Aggregate checkout stats                                      |
| `GET /checkout/addresses` | Deposit addresses (USDT/USDC), filter by `network`/`currency` |
| `GET /checkout/{uuid}`    | Public session details for your own pay page                  |

See the full schema in the [Payments API Reference](/api-reference/introduction) under
**Checkout (Crypto Gateway)**.
