> Index of every page: https://docs.merchantservicedepot.com/llms.txt

# Create checkout session (embedded)


`POST /v1/checkout_sessions`

Opens a checkout session from the merchant's page. `intent` is `one_time` (the token will be charged) or `store` (the token will be attached to a customer with `POST /v1/payment_methods` — the session itself saves nothing); the whole body is optional and defaults to `one_time`. Optionally add `amount` (minor units, up to 99999999) and `currency` (default `USD`) on a `one_time` session, so **Quote a tip and tax** has a base to price. It is a quote hint only and never the amount charged.

Set `ELEMENTS_ORIGIN` in the environment to an origin on this key's allow-list — you manage that list in the portal (Settings → API keys). The request sends it as the `Origin` header, standing in for the checkout page a browser would name; without it (or with an origin not on the list) the answer is **401** before the body is even read.

Returns `sessionId`, a `mountUrl` to iframe, and `modifiers` — your own surcharge/tax/tip configuration, so your page can render a tip control. Nothing in the response names a provider or differs by which one settles the account — that uniformity is the contract, not an implementation detail.

The card frame fetches its own configuration from the session id; it does not pass through your page. That is why nothing here identifies a provider even indirectly.

**401** means the `Origin` header is missing or not on this key's allow-list.

Auth: a publishable key. Returns `201` with Checkout session.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `intent` | body | string | No | Whether the card will fund one payment or be stored for later use. |

## Request

**curl**

```curl
curl -X POST "https://payments-api-sandbox.merchantservicedepot.com/v1/checkout_sessions" \
  -H "Authorization: Bearer $MYELA_PUBLISHABLE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "intent": "one_time"
}'
```

**Node**

```node
const res = await fetch("https://payments-api-sandbox.merchantservicedepot.com/v1/checkout_sessions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MYELA_PUBLISHABLE_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "intent": "one_time"
  }),
});

if (!res.ok) {
  const { error } = await res.json();
  // Branch on error.code — never on error.message.
  throw new Error(error.code);
}
const data = await res.json();
```

**Python**

```python
import os
import requests

res = requests.post(
    "https://payments-api-sandbox.merchantservicedepot.com/v1/checkout_sessions",
    headers={
        "Authorization": f"Bearer {os.environ['MYELA_PUBLISHABLE_KEY']}",
    },
    json={
        "intent": "one_time"
    },
)

if not res.ok:
    # Branch on error["code"] — never on error["message"].
    raise RuntimeError(res.json()["error"]["code"])
data = res.json()
```

## Response

| Field | Type | Description |
| --- | --- | --- |
| `sessionId` | string | Short-lived checkout-session capability. |
| `mountUrl` | string | Hosted-frame URL. The session stays in the URL fragment. |
| `expiresAt` | string | ISO 8601 expiration timestamp. |
| `capture` | object | Opaque provider-neutral capture configuration. |
| `parentOrigin` | string | Origin authorized to host the frame. |

```json
{
  "sessionId": "cs_01JEXAMPLE",
  "mountUrl": "https://js.merchantservicedepot.com/v1/frame.html#session=cs_01JEXAMPLE",
  "expiresAt": "2026-08-10T20:51:51.653Z",
  "capture": {
    "scriptUrl": "https://sandbox.example/capture.js"
  },
  "parentOrigin": "https://merchant.example"
}
```

Source: https://docs.merchantservicedepot.com/api-reference/create-checkout-session-embedded/
