---
search:
  tags:
    - Customers
    - POST
seo:
  description: >-
    Admin, branch manager, or cashier. Records a payment and… Reference for the
    POST /api/v1/customers/{customerId}/payments endpoint in the PharmaFlow API.
sidebar:
  label: Record a customer payment
  badge: POST
title: Record a customer payment
type: openapi-operation
---
Admin, branch manager, or cashier. Records a payment and lowers the customer's balance. The amount must be positive and no more than the balance, and the write is one transaction.

`POST /api/v1/customers/{customerId}/payments`

**Request body** (`application/json`, required)

- `amount` (number, required)
- `notes` (string)

Request body example:

```json
{
  "amount": 0,
  "notes": ""
}
```

**Responses**

- `201` — Payment recorded
- `400` — The amount is not positive, or it exceeds the customer's outstanding balance
- `401` — Not authenticated
- `403` — Caller is not an admin, branch manager, pharmacist, or cashier
- `404` — Customer not found

Response example, 201:

```json
{
  "ledger_id": "string",
  "customer_id": "string",
  "amount_paid": "string",
  "previous_balance": "string",
  "new_balance": "string",
  "paid_at": "string"
}
```
