# POST /api/v1/credit/sandbox/card-transactions

> Clear, void or dispute a card transaction

- **Tag:** credit
- **Operation ID:** `record_sandbox_card_transaction`

## Description

Sandbox only. Reports a transaction on a mock-issued card the way Ramp's webhook would, and sends it through the same ingest: a `cleared` purchase becomes a loan with no call from you, a negative amount is a refund, a `voided` one reverses the loan (or holds it when money was paid on it), a `disputed` one opens a hold. Returns what happened. A card on a live issuer program is `CREDIT_710`; a void or dispute of a transaction the book does not hold is `CREDIT_711`.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `SandboxCardTransactionRequest`

- `card_id` (string · required) — The card's `id` from `POST /credit/cards`. The card must be on a program whose issuer is the mock issuer (`CREDIT_710` otherwise).
- `kind` (string) (one of: cleared, voided, disputed) — `cleared`: the issuer reports a purchase (or, with a negative amount, a refund) as settled. `voided`: it now reports a cleared transaction voided. `disputed`: it lists a dispute on one.
- `amount_cents` (integer) — `cleared` only, required. Signed cents: positive is a purchase, negative a refund. Ignored for the other kinds, which read the amount from the transaction already recorded.
- `merchant_name` (string) — `cleared` only. The merchant.
- `merchant_category_code` (string) — `cleared` only. Four-digit merchant category code.
- `settled_on` (string · date) — `cleared` only. The settlement date. Defaults to today, and may be later on a sandbox.
- `issuer_transaction_id` (string) — The issuer's transaction id. Optional for `cleared` (one is generated and returned; sending the same id again is a duplicate, not a second loan). Required for `voided` and `disputed`, which name a transaction recorded earlier (`CREDIT_711` if there is none).
- `refund_of_issuer_transaction_id` (string) — `cleared` with a negative amount: the transaction it refunds.

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_SandboxCardTransactionResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (SandboxCardTransactionResponse)

### 400 — Bad Request - Invalid input

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 401 — Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 403 — Forbidden - Insufficient permissions

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 404 — Not Found - Resource does not exist

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 422 — Validation Error

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/credit/sandbox/card-transactions' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "card_id": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/credit/sandbox/card-transactions', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "card_id": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {'card_id': 'string'}

response = httpx.post("https://api.ondayzero.com/api/v1/credit/sandbox/card-transactions", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/credit/record-sandbox-card-transaction
- OpenAPI slice: https://www.ondayzero.com/docs/reference/credit/record-sandbox-card-transaction/openapi.json
- Other endpoints in **credit**: https://www.ondayzero.com/docs/reference/credit (markdown bundle: https://www.ondayzero.com/docs/reference/credit.md, OpenAPI: https://www.ondayzero.com/docs/reference/credit/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
