---
title: "Let our agent buy your plan: add or replace the code, test-mode login or seat on your order, until a drive has it (409 pay_in_use while one does; 409 order_closed once its drive is over)"
method: POST
path: "/api/orders/{id}/pay"
tags: ["Orders"]
---

# Let our agent buy your plan: add or replace the code, test-mode login or seat on your order, until a drive has it (409 pay_in_use while one does; 409 order_closed once its drive is over)

`POST /api/orders/{id}/pay`

## Request

- Base URL: `https://agentdrives.com`
- URL: `https://agentdrives.com/api/orders/{id}/pay`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

## Path parameters

- `id` string, required

## Request body

- object: Let our agent buy your plan, at your own checkout (optional on an Audit Drive, required on a Payment proof). kind code: your discount code, that leaves $0.50 a purchase: our card pays that on the order, at cost, and cancels the plan (with authorise: true; on an Audit Drive the purchase is in the price and one code works up to 10 times until 120 days after the report); on the free checkout test a 100% off code; sandbox: a login to your checkout's test mode or sandbox; seat: no value, we email you the address our agent signed up with, and you upgrade it. Sealed, never shown back, deleted after the drive that used it
  - `kind` 'code' | 'sandbox' | 'seat', required
  - `value` string: code: 6 to 64 letters, digits, dots, dashes or underscores; sandbox: the login, up to 2,000 characters

## Response `200`

Stored

- object
  - `pay` object, nullable: What you gave so our agent buys your plan: never the value
    - `kind` 'code' | 'sandbox' | 'seat'
    - `hint` string, nullable: A code's last two characters
    - `status` 'waiting' | 'handed' | 'done' | 'removed': waiting: kept for the drive; handed: a drive has it now; done: that drive ended and it is deleted; removed: you removed it, or the order ended first
    - `at` string, date-time, nullable
    - `mailed_at` string, date-time, nullable: A seat: when we sent you the address our agent signed up with

## Other responses

- `400`: Error as problem details (RFC 9457) with a machine-readable `error` and a `fix` that says what to do next
- `404`: Error as problem details (RFC 9457) with a machine-readable `error` and a `fix` that says what to do next
- `409`: Error as problem details (RFC 9457) with a machine-readable `error` and a `fix` that says what to do next

---

[API](https://skmtc.dev/agentdrives/apis/agentdrives-api.md) · [All operations](https://skmtc.dev/agentdrives/apis/agentdrives-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentdrives/apis/agentdrives-api/revisions/94dcaabff4b2?raw)
