# POST /api/v1/purchase-orders/{id}/payments

> Record payment for purchase order

- **Tag:** purchase-orders
- **Operation ID:** `record_order_payment_api_v1_purchase_orders__id__payments_post`

## Description

Link a bank transaction to a purchase order as a payment.

## Authentication

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

## Parameters

- `id` (path, string · uuid, required)

## Request body

Schema: `OrderPaymentRequest`

- `transaction_id` (string · required) — UUID of the bank transaction representing the payment.
- `amount` (integer · required) — Payment amount in cents. Must be > 0.
- `paid_on` (string · date-time) — Override payment date (ISO 8601). Defaults to the transaction datetime if omitted.

## Responses

### 201 — Successful Response

Schema: `OrderPaymentResponse`

- `id` (string · required) — Payment UUID.
- `inventory_order_id` (string · required) — Parent order UUID.
- `amount` (integer · required) — Payment amount in cents.
- `paid_on` (string · date-time) — Payment date.
- `transaction_id` (string) — Linked bank transaction UUID.
- `method` (string) — Payment method.

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

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

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/purchase-orders/{id}/payments' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "transaction_id": "string",
  "amount": 0
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/purchase-orders/{id}/payments', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "transaction_id": "string",
  "amount": 0
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "transaction_id": "string",
  "amount": 0
}

response = httpx.post("https://api.ondayzero.com/api/v1/purchase-orders/{id}/payments", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/purchase-orders/record-order-payment
- OpenAPI slice: https://www.ondayzero.com/docs/reference/purchase-orders/record-order-payment/openapi.json
- Other endpoints in **purchase-orders**: https://www.ondayzero.com/docs/reference/purchase-orders
