# Record a payment

`POST /lokta-lms/api/v1/invoices/{id}/payments`

Records a payment already made against a partner invoice.

**This records a payment already made; it does not make one.** Nothing in this API moves money.

**One money figure.** `amount_paid` is what the invoice was settled by. TDS is not modelled by this system; any split between the partner's bank and a tax authority is owned outside, and nothing here computes or records withholding.

Recording what actually left the bank instead would leave every invoice permanently short by exactly the tax withheld, and a discrepancy equal to a real quantity reads as an explanation rather than an error: someone reconciles, finds the gap matches the withholding, and chases a payment that is not missing.

A partial payment leaves the invoice unpaid rather than rounding up; "mostly paid" is not a state anyone can act on, and calling it paid loses the outstanding balance. Overpayment is refused (`422 sourcing/payment_exceeds_invoice_total`).

`bank_account_id`, if supplied, must belong to this invoice's partner; scoped in the query, because paying one partner into another's account is the worst thing this API could do.

## When to use it

Use this to record a payment that has already been made. Nothing in this API moves money.

## Worth knowing
- A partial payment leaves the invoice unpaid.
- Overpayment is refused with 422 sourcing/payment_exceeds_invoice_total.
- Send an Idempotency-Key header.

## Parameters
- `id` (path, string, required)
- `Idempotency-Key` (header, string): Per-intent key; a replayed payment must not pay twice

## Request body (application/json)
- `amount_paid` (string): What the invoice was settled by.
- `bank_account_id` (string): Optional. It must belong to this invoice's partner.

## Responses
- `default`: default response

## Example request (cURL)
```bash
curl -X POST \
  'https://default.lokta.tech/lokta-lms/api/v1/invoices/{id}/payments' \
  -u '{username}:{password}' \
  -H 'Tenant-Identifier: default' \
  -H 'Content-Type: application/json' \
  -d '{
  "amount_paid": "string",
  "bank_account_id": "string"
}'
```

Interactive: https://developer.lokta.ai/reference#operation/recordPayment
