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

# Create a Payment Intent

Creates a new Payment Intent. The intent enters `pending` status until
you call `/confirm`. Requires the `flynet_merchant_id` issued during
onboarding.

<Warning>
  **Chef's warning** - `idempotency_key` is required. Use the customer's
  order ID so retries dedupe naturally.
</Warning>

Auth: OAuth access token.

## Request body

```json theme={null}
{
  "flynet_merchant_id": "{merchant_uuid}",
  "customer_user_id": "{uuid}",
  "amount": { "value": "1000000000000000000", "currency": "FLY" },
  "description": "Event ticket",
  "idempotency_key": "order-12345",
  "expires_at": "2026-05-30T00:00:00Z",
  "metadata": { "order_id": "12345" }
}
```

`expires_at` and `metadata` are optional. All other fields are required.

## Response

HTTP 201 on first create:

```json theme={null}
{
  "id": "{uuid}",
  "object": "payment_intent",
  "payer_account_balance_id": "{uuid}",
  "payee_account_balance_id": "{uuid}",
  "amount": { "value": "1000000000000000000", "currency": "FLY" },
  "description": "Event ticket",
  "status": "pending",
  "expires_at": "2026-05-30T00:00:00Z",
  "canceled_at": null,
  "paid_at": null,
  "refunded_at": null,
  "metadata": { "order_id": "12345" },
  "created_at": "2026-05-11T20:00:00Z",
  "updated_at": "2026-05-11T20:00:00Z"
}
```

Same `idempotency_key` plus same `flynet_merchant_id` returns HTTP 200
with the existing intent.

## Errors

| Code                        | Meaning                                          |
| --------------------------- | ------------------------------------------------ |
| 400 `invalid_request_error` | Request body is malformed.                       |
| 401                         | Missing or invalid OAuth bearer. Empty body.     |
| 404 `resource_not_found`    | `flynet_merchant_id` is not visible to your app. |
