Skip to main content
POST
Checkout Sessions
A checkout session prices one tool call, takes payment, and runs the tool. Create it, update it if the input changes, then complete or cancel it within 30 minutes. Completing it returns a request_id you poll for results.
Paid endpoints on this page accept optional memo (≤ 1000 chars) and decisionContext (object) body fields. Both are stored on the receipt for debugging and audit. See Audit Trail.

Session Lifecycle

A new session is ready_for_payment. It ends in one of two terminal states.
completed and canceled are terminal: a session in either state can’t be updated, completed, or canceled. Sessions expire after 30 minutes. An expired session can’t be completed or updated.

Create Session

Creates a checkout session for one product and returns its exact price.

Request

Parameters

Response (201)

Use idempotency_key to retry session creation safely. If a session with the same key exists, the API returns it (200) instead of creating a new one (201).

Retrieve Session

Returns the current state of a checkout session.
For completed sessions, the response includes an order object:

Update Session

Changes buyer info or input parameters, or switches product. Allowed only while status is ready_for_payment.
Send buyer, line_items, or both. Changing item.id to another product updates the price.

Complete Session

Charges a Stripe SharedPaymentToken and starts the tool. Returns an order with a request_id.

Response (200)

Poll job status with GET /v1/requests/{request_id}, using the returned request_id.

Error Responses

Check order.status even on HTTP 200. If payment succeeds but the tool fails, completion returns HTTP 200 with status: "completed" and order.status: "failed". The order carries error_code (one of the codes below) and error (the generic message). Validation errors and caught payment or execution failures include a machine-readable code and a human-readable message. Branch on code, not on the text of message: Caught exceptions return a generic message, not provider error details:
A missing session returns 404 with type: "not_found" and message: "Session not found", without a code.

Cancel Session

Cancels a session. Allowed only while status is ready_for_payment or not_ready_for_payment.

Response (200)