The Payments API records monetary transactions against existing orders. Each call toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/FloresJesus/SS_RESTAURANT/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/payments inserts a row into the pago table, recalculates the running total paid for the order, and flips estado_pago to pagado once the cumulative amount meets or exceeds the order total. In the same atomic transaction the endpoint can optionally create a sale ticket (ticket) and a tax invoice (factura) so that a full cashier workflow requires only a single HTTP request. All endpoints — reads and writes — are restricted to the admin and cajero roles.
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/payments | admin, cajero | List all payments, optionally filtered by order |
GET | /api/payments/resumen-diario | admin, cajero | Today’s payment totals broken down by method |
GET | /api/payments/:id | admin, cajero | Get a single payment record by its ID |
POST | /api/payments | admin, cajero | Process a payment for an order |
GET /api/payments
Returns every payment record joined with its parent order and table number. Pass?pedido_id= to filter results to a specific order.
Query parameters
Filter payments to a single order. Omit to retrieve all payments.
GET /api/payments/resumen-diario
Returns today’s payment totals grouped by payment method. Useful for end-of-day cash reconciliation.Payment method:
efectivo, tarjeta, qr, or transferencia.Number of individual payment transactions made with this method today.
Sum of all amounts collected via this method today, in Bolivianos (Bs).
GET /api/payments/:id
Fetches a single payment record by primary key. Returns404 if the record does not exist.
POST /api/payments
Processes a payment for an existing order. This is a transactional operation: the payment is inserted, the running total for the order is recalculated, and the order’sestado_pago is updated — all in a single database transaction. If generar_ticket or generar_factura are set, the corresponding documents are created in the same transaction only when the order becomes fully paid.
Request body
The ID of the order being paid.
Amount to apply to this payment, in Bolivianos (Bs). Partial payments are allowed; the order status transitions to
pagado once the cumulative total meets or exceeds the order total.Payment method. Must be one of:
efectivo, tarjeta, qr, transferencia.Optional transaction reference — e.g., card authorization code, QR transaction ID, or bank transfer number.
When
true and the order becomes fully paid, a sale ticket is automatically generated and included in the response. If the order already has a ticket, the existing ticket is returned. Defaults to false.When
true and the order becomes fully paid, a tax invoice (factura) is automatically generated. Requires nit_ci and razon_social. Defaults to false.Taxpayer NIT or personal CI number. Required when
generar_factura is true.Legal name or business name for the invoice. Required when
generar_factura is true.Response
Human-readable confirmation:
"Pago registrado".The auto-generated primary key of the new payment record.
Updated payment status for the order:
pendiente if more payment is still owed, pagado if the order is fully covered.Cumulative amount paid against this order so far, in Bolivianos (Bs).
Present only when
generar_ticket: true was passed and the order is now pagado.Present only when
generar_factura: true was passed, the order is pagado, and nit_ci / razon_social were provided.Example — pay in cash, generate ticket and invoice
201 Created:
Error responses
| Status | Condition |
|---|---|
400 | Missing pedido_id, monto, or metodo |
400 | metodo is not one of efectivo, tarjeta, qr, transferencia |
400 | generar_factura: true but nit_ci or razon_social not provided |
404 | Order with the given pedido_id does not exist |
500 | Database or internal error |