Skip to content
PharmaFlow Knowledgebase
Esc
↑↓navigate↵open⌘Jpreview

Record a customer payment

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
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT from POST /api/v1/auth/login sent as Authorization Bearer.

Path parameters
customerIdstringrequired

The customer paying.

Request body
requiredapplication/json
amountnumberrequired
notesstring
default: ""
Responses
201

Payment recorded

ledger_idstringrequired
customer_idstringrequired
amount_paidstringrequired
previous_balancestringrequired
new_balancestringrequired
paid_atstringrequired
400

The amount is not positive, or it exceeds the customer's outstanding balance

detailstringrequired
401

Not authenticated

detailstringrequired
403

Caller is not an admin, branch manager, pharmacist, or cashier

detailstringrequired
404

Customer not found

detailstringrequired
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'http://localhost:8000/api/v1/customers/string/payments' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "amount": 0,
  "notes": ""
}'
Response
{
  "ledger_id": "string",
  "customer_id": "string",
  "amount_paid": "string",
  "previous_balance": "string",
  "new_balance": "string",
  "paid_at": "string"
}