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

# Update Checkout Session

> Patch the cart, buyer, or answers on an open session

# Update Checkout Session

Patches an open session and returns it re-priced. This is how you clear blocking `messages[]` and move a session to `ready_for_payment`.

<Note>
  Requires `checkout: write`, an allowlisted partner key, and a **signed request** — same headers as [create](/api-reference/checkout-sessions/create-checkout-session#headers).
</Note>

Note the method: ACP uses `POST`, not `PATCH`, for updates.

## Path Parameters

<ParamField path="checkout_session_id" type="string" required>
  The session to update.
</ParamField>

## Body

Every field is optional — send only what changes.

<ParamField body="items" type="array">
  1–20 lines. **Replaces the cart wholesale**, it is not merged. To change one line, send all the lines you want.
</ParamField>

<ParamField body="buyer" type="object">
  `name` and `email` required when present. Commonly used to supply the buyer after creating a session without one.
</ParamField>

<ParamField body="attendee_answers" type="array">
  Up to 50 answers. **Replaces the stored set wholesale**, like `items`.
</ParamField>

<ParamField body="fulfillment_address" type="object">
  Required before payment when the cart contains a posted ticket.
</ParamField>

<ParamField body="fulfillment_option_id" type="string">
  The chosen option's id.
</ParamField>

<Warning>
  `items` and `attendee_answers` **replace**, they do not merge. Sending `items: [{id: "A", quantity: 1}]` on a session that held A and B removes B.
</Warning>

## Response

`200` with the re-priced [session](/api-reference/checkout-sessions/get-checkout-session#response).

Totals are recalculated on every update, so a price change or a tier selling out shows up here rather than surprising you at completion.

## Terminal sessions cannot be updated

A `completed` or `canceled` session is immutable and returns `409 invalid_session_state`.

A completed session is immutable because editing the cart behind a paid order would make the stored session disagree with what the buyer was actually charged for and what their tickets say.

## Working through blockers

```javascript Clearing blocking messages theme={null}
let session = await createSession(items);

while (session.status === "not_ready_for_payment") {
  const blockers = session.messages.filter((m) => m.type === "error");
  if (!blockers.length) break; // not payable, but nothing actionable

  const patch = {};
  for (const m of blockers) {
    if (m.param === "buyer.name") patch.buyer = await askBuyer();
    if (m.param?.startsWith("attendee_answers")) {
      patch.attendee_answers = await askQuestions();
    }
    if (m.code === "out_of_stock") return handleSoldOut(m);
  }
  if (!Object.keys(patch).length) return giveUp(blockers);

  session = await updateSession(session.id, patch);
}
```

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST \
    "https://www.gomry.com/api/v1/checkout_sessions/acp_sess_AbCdEfGhIjKlMnOpQrSt" \
    -H "X-API-KEY: your_api_key" \
    -H "Content-Type: application/json" \
    -H "API-Version: 2025-09-12" \
    -H "Timestamp: 2026-09-10T12:01:00Z" \
    -H "Signature: base64-hmac-sha256" \
    -d '{ "buyer": { "name": "Ada Lovelace", "email": "ada@example.com" } }'
  ```

  ```javascript JavaScript theme={null}
  const body = JSON.stringify({
    buyer: { name: "Ada Lovelace", email: "ada@example.com" },
  });
  const timestamp = new Date().toISOString();
  const signature = crypto
    .createHmac("sha256", process.env.GOMRY_ACP_SIGNING_SECRET)
    .update(`${timestamp}.${body}`)
    .digest("base64");

  const res = await fetch(
    `https://www.gomry.com/api/v1/checkout_sessions/${sessionId}`,
    {
      method: "POST",
      headers: {
        "X-API-KEY": process.env.GOMRY_API_KEY,
        "Content-Type": "application/json",
        "API-Version": "2025-09-12",
        Timestamp: timestamp,
        Signature: signature,
      },
      body,
    }
  );
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "acp_sess_AbCdEfGhIjKlMnOpQrSt",
    "buyer": { "name": "Ada Lovelace", "email": "ada@example.com" },
    "status": "ready_for_payment",
    "currency": "usd",
    "line_items": [
      {
        "id": "li_1",
        "item": { "id": "TktAbCdEfGhIjKlMnOpQ", "quantity": 2 },
        "base_amount": 15800,
        "discount": 0,
        "subtotal": 15800,
        "tax": 0,
        "total": 16790
      }
    ],
    "totals": [
      { "type": "items_base_amount", "display_text": "Tickets", "amount": 15800 },
      { "type": "fee", "display_text": "Service fee", "amount": 990 },
      { "type": "total", "display_text": "Total", "amount": 16790 }
    ],
    "messages": []
  }
  ```
</ResponseExample>
