> ## 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.

# Create a payment

> Create a hosted checkout session and get a checkout_url to send the customer to.

Creates a payment session. Redirect the customer to the returned `checkout_url`;
Pesarc hosts the payment page, settles on-chain and sponsors gas.

## Request

<ParamField header="Authorization" type="string" required>
  `Bearer sk_live_…`
</ParamField>

<ParamField body="amount" type="number" required>
  Amount to charge, in `currency`. Positive, up to 1,000,000,000.
</ParamField>

<ParamField body="currency" type="string" required>
  Currency code, 2–8 characters (e.g. `NGN`, `GHS`, `KES`).
</ParamField>

<ParamField body="redirect_url" type="string" required>
  Where to send the customer when they finish. Must be a valid URL.
</ParamField>

<ParamField body="reference" type="string">
  Your own id for this payment (max 64 chars). Use it to reconcile and dedupe.
</ParamField>

<ParamField body="merchant_name" type="string">
  Name shown to the customer on the checkout page (max 80 chars).
</ParamField>

<ParamField body="description" type="string">
  Short description of what's being paid for (max 300 chars).
</ParamField>

<ParamField body="webhook_url" type="string">
  URL Pesarc POSTs settlement events to. See [Webhooks](/integrations/webhooks).
</ParamField>

<ParamField body="payout_address" type="string">
  Optional `0x` EVM address to settle this payment to.
</ParamField>

<ParamField body="metadata" type="object">
  Arbitrary key/value data echoed back to you on reads and webhooks.
</ParamField>

<ParamField body="ttl_minutes" type="integer">
  How long the session stays open, 1–1440 minutes.
</ParamField>

## Response

<ResponseField name="checkout_url" type="string">
  The hosted page to redirect the customer to.
</ResponseField>

<ResponseField name="id" type="string">The payment id.</ResponseField>
<ResponseField name="status" type="string">Initial status (e.g. `pending`).</ResponseField>

<RequestExample>
  ```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://ada-fabrics.com/thanks",
      "webhook_url": "https://ada-fabrics.com/api/pesarc/webhook"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "pay_7Q2m",
    "checkout_url": "https://pesarc.xyz/checkout/pay_7Q2m",
    "status": "pending"
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "type": "invalid_request_error",
      "message": "payout_address must be a 0x EVM address"
    }
  }
  ```
</ResponseExample>

<Note>
  Confirm the final outcome server-side — via [webhooks](/integrations/webhooks) or
  [`GET /checkout/:id`](/api-reference/get-checkout) — rather than trusting the
  browser redirect.
</Note>
