---
title: "Cancel a checkout"
method: POST
path: "/gateway/sessions/{sessionId}/cancel"
tags: ["Checkouts"]
---

# Cancel a checkout

`POST /gateway/sessions/{sessionId}/cancel`

## Request

- Base URL: `https://api.agentaos.ai/api/v1`
- URL: `https://api.agentaos.ai/api/v1/gateway/sessions/{sessionId}/cancel`
- Auth: API key in header `x-api-key`

Stops the buyer from paying. If a payment already cleared before the cancel call lands, it still completes: cancelling doesn't reach into the card processor or on-chain state after the fact. Only works while the checkout is `open` (`400` otherwise).

## Path parameters

- `sessionId` string, required

## Response `200`

The checkout was cancelled.

- SuccessResponse
  - `success` true, required

## Other responses

- `400`: A required field is missing, out of range, or the wrong type. `ValidationPipe` also rejects any field not in the documented schema.
- `401`: Missing or invalid `x-api-key`.
- `403`: The key is valid but the resource belongs to a different organization.
- `404`: Resource not found (or not visible to your key; the two are not distinguished).
- `409`: The resource was modified concurrently, or the action doesn't apply to its current state.

---

[API](https://skmtc.dev/agentaos/apis/agentaos-gateway-api.md) · [All operations](https://skmtc.dev/agentaos/apis/agentaos-gateway-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentaos/apis/agentaos-gateway-api/revisions/3a8ad3c6b965?raw)
