# Patient billing

Canonical page: https://docs.ovok.com/python-sdk/namespaces/patient-billing

`ovok.patient_billing` keeps what a patient pays for and who pays it: their insurance coverages, their plan, their billing accounts and their invoices.

## Record insurance [#record-insurance]

```python
from ovok_sdk import check_member_number

insurer = ovok.patient_billing.insurers.list({"country": "DE", "kind": "statutory", "query": "AOK"})[0]

if check_member_number(country="DE", kind="statutory", value="A123456780"):
    coverage = ovok.patient_billing.coverages.create(
        "123", {"kind": "statutory", "insurerIk": insurer["ik"], "memberNumber": "A123456780"}
    )
```

- `check_member_number` runs the same rule as the server. A statutory number is a KVNR whose check digit matches. A private policy number has 1 to 30 characters. Only Germany (`DE`) is supported.
- `coverages.update` takes `if_version`, the `version` you read. A coverage changed since then is refused with `OvokConflictError`.
- `coverages.remove` removes a coverage.

## Set the plan [#set-the-plan]

```python
ovok.patient_billing.plans.set("123", {"plan": {"code": "premium"}, "period": {"start": "2026-12-01"}})

ovok.patient_billing.plans.set("123", {"plan": None})
```

- `plans.retrieve` reads the patient's plan. Setting `plan` to `None` ends it and answers `None`.

## Read accounts and invoices [#read-accounts-and-invoices]

```python
for invoice in ovok.patient_billing.invoices.list("123").auto_paging_iter():
    print(invoice["identifier"], invoice["status"])
```

- `accounts.list` and `accounts.retrieve` read the patient's billing accounts.
- `invoices.record` records an invoice issued elsewhere. Sending the same `identifier` again answers the same invoice, so the SDK retries it safely.

## See also [#see-also]

- [Patient](/python-sdk/namespaces/patient)
- [`PatientBillingResource` reference](/python-sdk/reference/resources/patient_billing#patientbillingresource)
