The Payments API manages theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Nieto2020/portalhub/llms.txt
Use this file to discover all available pages before exploring further.
pagos_facturacion table, which tracks monetary transactions between clients and the consultancy. Each payment record links a client, an optional accounting service (servicios_contables), a monetary amount, and two independent status fields: estado_pago (the payment collection status) and estado_factura (the invoicing status).
Clients can view their own payment history. Administrators and Asesors can see all payments and update statuses. Only authenticated users with the correct role can register new payments.
Payment and invoice status reference
estado_pago | estado_factura | Description |
|---|---|---|
Pendiente | Pendiente | Payment has been registered but not yet processed or confirmed. Default state on creation. |
Pagado | Pendiente | Payment confirmed as received. fecha_pago is set automatically to NOW(). Invoice not yet issued. |
Pagado | Emitida | Payment confirmed and invoice issued to the client. |
Cancelado | Pendiente | Payment was cancelled before collection. |
estado_pago and estado_factura are independent fields. Updating estado_pago via actualizar_estado.php does not automatically change estado_factura. Manage each field separately if your workflow requires coordinating both.GET /backend/modules/pagos/listar.php
Return all payment records visible to the authenticated user, ordered byid_pago DESC. The response includes joined fields from servicios_contables and cat_servicios for service context.
Authentication: Any authenticated user (checkAuth)
| Caller role | Records returned |
|---|---|
ROL_ADMIN (1) | All payments in the system |
ROL_ASESOR (2) | All payments in the system |
ROL_CLIENTE (3) | Only payments where id_cliente = session user |
Request
No parameters required.Auto-incremented primary key for the payment record.
id_usuario of the client associated with this payment.Foreign key to
servicios_contables. May be null if the payment is not tied to a specific service instance.Payment amount with two decimal places (e.g.,
"2500.00").Collection status:
Pendiente, Pagado, or Cancelado.Invoice status:
Pendiente or Emitida.Date and time the payment was confirmed. Set automatically when
estado_pago is updated to "Pagado". null until that transition occurs.Service status from
servicios_contables: Pendiente, En proceso, or Completado. null if no service is linked.Human-readable service name from
cat_servicios. null if no service is linked.Error responses
| HTTP | Message |
|---|---|
401 | No autorizado. Inicie sesión Primero. |
500 | Error en la consulta |
POST /backend/modules/pagos/registrar.php
Create a new payment record with an initialestado_pago of "Pendiente". The referenced id_servicio must exist in servicios_contables. The monto must be a positive numeric value.
Authentication: Any authenticated user (checkAuth)
Request body
The
id_usuario of the client for whom the payment is being registered.A valid
id_servicio from the servicios_contables table. The server verifies existence before inserting.The payment amount. Must be a positive numeric value. Stored as
DECIMAL(10,2).The auto-incremented ID of the newly created payment record.
Error responses
| HTTP | Message |
|---|---|
400 | Faltan campos requeridos |
400 | Monto no válido |
401 | No autorizado. Inicie sesión Primero. |
404 | Servicio no encontrado |
405 | Método no permitido |
500 | Error al registrar pago |
GET /backend/modules/pagos/detalle.php
Retrieve the full detail of a single payment record, including joined service and service-type information. Clients can only view their own payments; attempting to access another client’s payment returns HTTP 403. Authentication: Any authenticated user (checkAuth)
Query parameters
The ID of the payment record to retrieve.
Primary key of the payment.
id_usuario of the client associated with this payment.Foreign key to
servicios_contables, if applicable.Payment amount with two decimal places.
Current collection status:
Pendiente, Pagado, or Cancelado.Current invoice status:
Pendiente or Emitida.Timestamp when the payment was confirmed.
null until estado_pago transitions to "Pagado".Status of the linked service from
servicios_contables.Service name from
cat_servicios.Access control
| Session role | Intended access | Actual runtime behaviour |
|---|---|---|
ROL_ADMIN (1) | Any payment | Any payment |
ROL_ASESOR (2) | Any payment | Any payment |
ROL_CLIENTE (3) | Only where id_cliente = session user | Any payment |
Error responses
| HTTP | Message |
|---|---|
400 | ID de pago no proporcionado |
401 | No autorizado. Inicie sesión Primero. |
403 | No tiene permisos para ver este pago |
404 | Pago no encontrado |
405 | Método no permitido |
500 | Error al obtener detalle de pago |
POST /backend/modules/pagos/actualizar_estado.php
Update theestado_pago of a payment record. When estado_pago is set to "Pagado", the server automatically records fecha_pago = NOW() in the same UPDATE statement.
Required role: Admin (1) or Asesor (2)
This endpoint updates only
estado_pago. If you also need to update estado_factura (e.g., mark an invoice as issued), you must extend this endpoint or handle that update at the database level — the current implementation does not expose estado_factura as a writable field through this endpoint.Request body
The ID of the payment record to update.
The new payment status. Must be one of:
"Pendiente", "Pagado", or "Cancelado". Any other value returns HTTP 400.Automatic fecha_pago behaviour
When estado_pago is set to "Pagado", the SQL executed is:
"Pendiente" or "Cancelado", fecha_pago is left unchanged.
Error responses
| HTTP | Message |
|---|---|
400 | Faltan campos requeridos |
400 | Estado de pago no válido |
401 | No autorizado. Inicie sesión Primero. |
403 | Acceso denegado. Permisos insuficientes. |
404 | Pago no encontrado |
405 | Método no permitido |
500 | Error al actualizar estado de pago |