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

# Quickstart

> Create an API key and take your first hosted payment in about ten minutes.

This guide takes you from zero to a working, hosted checkout you can send a
customer to.

## 1. Get an API key

Open the app, go to **Developers**, and create a key. The full secret is shown
**once** — copy it immediately and store it somewhere safe. Keys look like:

```
sk_live_xxxxxxxxxxxxxxxxxxxxxxxx
```

<Warning>
  Treat your secret key like a password. Never commit it, never ship it in
  client-side code, and never paste it into a page or chat. If a key leaks, revoke
  it in **Developers** and create a new one.
</Warning>

You can also create a key over the API — see [API keys](/api-reference/keys).

## 2. Confirm the key works

Every request authenticates with an `Authorization: Bearer` header. Ping the API
to check your key and see which account it is scoped to:

<CodeGroup>
  ```bash cURL theme={null}
  curl https://pesarc.xyz/api/v1/ping \
    -H "Authorization: Bearer sk_live_xxx"
  ```

  ```ts TypeScript theme={null}
  const res = await fetch("https://pesarc.xyz/api/v1/ping", {
    headers: { Authorization: `Bearer ${process.env.PESARC_SECRET_KEY}` },
  });
  console.log(await res.json());
  ```
</CodeGroup>

```json Response theme={null}
{ "ok": true, "account": "acct_...", "live": true }
```

## 3. Create a payment

Create a hosted checkout session. The only required fields are `amount`,
`currency` and a `redirect_url` to return the customer to when they are done.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://pesarc.xyz/api/v1/payments \
    -H "Authorization: Bearer sk_live_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "amount": 50000,
      "currency": "NGN",
      "reference": "order_1042",
      "merchant_name": "Ada Fabrics",
      "redirect_url": "https://your-store.com/thanks",
      "webhook_url": "https://your-store.com/api/pesarc/webhook"
    }'
  ```

  ```ts TypeScript theme={null}
  const res = await fetch("https://pesarc.xyz/api/v1/payments", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.PESARC_SECRET_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      amount: 50000,
      currency: "NGN",
      reference: "order_1042",
      merchant_name: "Ada Fabrics",
      redirect_url: "https://your-store.com/thanks",
      webhook_url: "https://your-store.com/api/pesarc/webhook",
    }),
  });
  const { checkout_url } = await res.json();
  ```
</CodeGroup>

The response includes a `checkout_url`. Redirect the customer there.

## 4. Send the customer to checkout

Redirect to `checkout_url`. Pesarc hosts the payment page, handles the on-chain
settlement and gas sponsorship, then returns the customer to your `redirect_url`.

## 5. Confirm the result

Do not trust the browser redirect alone. Confirm the payment server-side:

* **Webhook** — if you passed a `webhook_url`, Pesarc notifies your endpoint when
  the payment settles. See [Webhooks](/integrations/webhooks).
* **Poll** — read the session status any time from
  [`GET /checkout/:id`](/api-reference/get-checkout).

<Check>
  That's a full loop: key → payment → hosted checkout → confirmation. From here,
  wire it into your [store](/integrations/ecommerce), your
  [SaaS billing](/integrations/saas), or an [AI agent](/integrations/agents).
</Check>
