Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FerchoSG/healthcare-web/llms.txt

Use this file to discover all available pages before exploring further.

CitaBox handles the full billing lifecycle for every consultation: generating an invoice, recording the payment method, and submitting the electronic bill to Costa Rica’s Ministerio de Hacienda. Each invoice is linked to a patient and optionally to a specific appointment, which lets the receptionist close out the day’s completed consultations in a single workflow from their dashboard.

Invoice fields

FieldTypeDescription
patient_idstring (UUID)The patient being billed.
appointment_idstring (UUID)The appointment this invoice covers. Optional but recommended for traceability.
total_amountnumberTotal amount charged, in Costa Rican colones (CRC). Derived from the service price when available.
service_descriptionstringFree-text description of the service rendered. Defaults to the appointment reason or service name.
payment_statusPAID / UNPAID / PARTIALCurrent payment state of the invoice.
payment_methodSINPE_MOVIL / TARJETA / EFECTIVO / TRANSFERENCIAHow the patient paid.
payment_referencestringTransaction reference number (e.g., SINPE confirmation code).
paid_amountnumberActual amount received. Used when payment_status is PARTIAL.
paid_atISO timestampDate and time payment was recorded. Set automatically when saving with a non-UNPAID status.
notesstringInternal notes for the billing record.

Hacienda integration fields

CitaBox submits invoices to the Ministerio de Hacienda electronic billing system. The following fields are managed by the system after submission:
FieldDescription
hacienda_consecutiveSequential invoice number assigned by Hacienda upon acceptance.
numeric_key50-digit unique key (clave numérica) generated per invoice.
hacienda_statusCurrent state with Hacienda: DRAFT, ACCEPTED, or REJECTED.
pdf_urlURL to the official PDF version of the accepted electronic invoice.
xml_urlURL to the XML document submitted to and accepted by Hacienda.
All invoices start with hacienda_status: DRAFT. A draft invoice is not a valid electronic bill under Costa Rican fiscal law (Ley 9635). The clinic’s Hacienda API key must be configured in the clinic settings before invoices can be submitted for acceptance. Do not issue draft invoices to patients as official receipts.

Billing workflow after a consultation

1

Confirm the consultation is completed

In the receptionist dashboard, check the “Pendientes de cierre” panel. It lists all appointments with status COMPLETED that do not yet have a fully paid invoice.
2

Open the checkout dialog

Click “Registrar cobro” next to the patient’s appointment. If an invoice already exists (e.g., marked as UNPAID earlier), the button shows “Editar cobro” and pre-populates the form with the existing values.
3

Select payment status and method

Choose the payment_status (Pagado, Parcial, or Pendiente) and the payment_method. If the patient paid in full, select Pagado. For partial payments, select Parcial and enter the paid_amount.
4

Enter the payment reference

For SINPE Móvil and transfers, paste the transaction confirmation number in the reference field. For card payments, enter the terminal voucher number.
5

Save the invoice

Click “Guardar cobro”. CitaBox creates a new invoice (or updates the existing one) with paid_at set to the current timestamp. The appointment disappears from the pending-closure list.

Payment methods

Costa Rica’s instant mobile payment network operated by BCCR. The patient sends the payment to the clinic’s registered SINPE number. The receptionist enters the SINPE confirmation number as the payment_reference. This is the most common payment method for in-clinic consultations.
Credit or debit card payment processed through a point-of-sale terminal. Enter the terminal voucher or approval code as the payment_reference.
Cash payment. No external reference is required, though a payment_reference can be used for internal receipt tracking. The paid_amount field is particularly useful here to record the exact amount tendered.
Direct bank transfer (SINPE Nacional or international wire). Enter the IBAN or transfer confirmation number as the payment_reference. Transfers may take time to confirm so the invoice can be saved as PARTIAL or UNPAID until the credit appears.

Listing and filtering invoices

All invoices are fetched from GET /billing/invoices. The receptionist dashboard loads them on startup alongside the day’s appointments to populate the pending-closure panel. The full invoice list (including historical invoices) is accessible from the billing section of the admin area. Each invoice in the list includes the linked patient summary and, when present, the associated appointment’s start time and status — making it straightforward to reconcile billing against the day’s schedule.

Build docs developers (and LLMs) love