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

# Create a checkout session

> Start a hosted payment page for an amount your server sets.

Creates a session and returns it. Send the payer to `https://pay.talescria.com/pay/s/{id}`. See [Hosted checkout](https://docs.talescria.com/guides/checkout.md).

Requires the `checkout:write` scope. The payment lands in your default account for the currency.

**amount** `object` *required*

**properties**

**minorUnits** `string` *required*

Integer minor units, as a string.

**currency** `string` *required*

ISO 4217 code, for example `USD`.

**country** `string` *required*

ISO 3166-1 alpha-2 code for where the payment is taken, for example `US`.

**methods** `string[]`

Payment methods to offer. Use `["card"]`. Leave it out for every method available to your account.

**ttlMs** `integer`

How long the session stays open, in milliseconds. Default `1800000` (30 minutes).

### Response

**session** `object`

The session. See [Retrieve a checkout session](https://docs.talescria.com/api-reference/checkout/retrieve-a-session.md) for its fields.

### Errors

| Status | Code | Meaning |
| - | - | - |
| `400` | `VALIDATION` | A field is missing or malformed, or there's no account in this currency. |
| `401` | `UNAUTHORIZED` | The access token isn't valid. |
| `422` | `METHOD_NOT_AVAILABLE` | A method you asked for isn't available. |
| `502` | `IDENTITY_UNAVAILABLE` | Temporarily unavailable. Retry. |

```bash curl theme={null}
curl https://pay.talescria.com/v1/sessions \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"amount": {"minorUnits": "12999", "currency": "USD"}, "country": "US", "methods": ["card"]}'
```

```json 201 theme={null}
{
  "session": {
    "id": "chk_3f6e2c1a-…",
    "state": "open",
    "amount": { "minorUnits": "12999", "currency": "USD" },
    "country": "US",
    "merchantName": "Acme Studio Ltd",
    "environment": "test",
    "availableMethods": ["card"],
    "paymentId": null,
    "nextAction": null,
    "underReview": false,
    "attempts": [],
    "createdAt": 1763128800000,
    "expiresAt": 1763130600000,
    "updatedAt": 1763128800000
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.