---
title: "Pay and place the order"
method: POST
path: "/api/agent/complete_checkout"
tags: ["checkout"]
---

# Pay and place the order

`POST /api/agent/complete_checkout`

## Request

- Base URL: `https://www.test-well.com`
- URL: `https://www.test-well.com/api/agent/complete_checkout`
- Auth: none declared

Charge the payment credential the platform obtained for a session that is ready_for_payment and create the order. Input follows the ChatGPT payment-sheet contract: checkout_session_id, buyer, payment_data { token, provider: 'stripe', billing_address }.

## Request body

- object
  - `checkout_session_id` string, required
  - `buyer` object, nullable
    - `name` string, nullable
    - `first_name` string, nullable
    - `last_name` string, nullable
    - `email` string, email, nullable
    - `phone_number` string, nullable
  - `payment_data` object, required
    - `token` string, required
    - `provider` string: 'stripe'
    - `billing_address` object, nullable
      - `name` string
      - `line_one` string
      - `line_two` string
      - `city` string
      - `state` string
      - `country` string
      - `postal_code` string
  - `idempotency_key` string

## Response `200`

Tool result

- object
  - `tool` 'complete_checkout', required
  - `result` object, required
    - `id` string, required
    - `status` string, required
    - `totals` object[], required
      - `type` string, required
      - `display_text` string, required
      - `amount` number, required
    - `messages` object[], required
      - `type` 'info' | 'error', required
      - `content` string, required
    - `order` object
      - `id` string, required
      - `checkout_session_id` string, required
      - `permalink_url` string, required

## Other responses

- `400`: Invalid input
- `429`: Rate limited

---

[API](https://skmtc.dev/test-well/apis/testwell-agent-api.md) · [All operations](https://skmtc.dev/test-well/apis/testwell-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/test-well/apis/testwell-agent-api/revisions/6e260731dfa4?raw)
