API REST – ImaCash
Esta API permite la comunicación segura entre el software ImaCash, los terminales POS y el servidor de gestión, usando peticiones HTTP con formato JSON. El acceso está protegido por token.
Autenticación
Todas las peticiones deben incluir esta cabecera:
Authorization Header
Authorization: Bearer TU_TOKEN_VALIDADO
Handshake – Validar e intercambiar token
POST Handshake
/handshake.php
Solicitud
JSON
{
"token": "abcd1234xyz"
}
Respuesta
JSON
{
"status": "ok",
"message": "Token válido"
}
putinventory.php – Enviar inventario
POST Enviar inventario
/putinventory.php
Solicitud
JSON
{
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"nombre_maquina": "Caja Altea",
"currency": "EUR",
"datetime": "2025-05-06 14:00:00",
"coins": { "0.01": 120, "0.02": 80 },
"bills": { "5": 10, "10": 5 }
}
Respuesta
JSON
{
"status": "ok",
"message": "Inventario recibido"
}
getinventory.php – Obtener último inventario
GET Obtener último inventario
/getinventory.php
Respuesta
JSON
{
"status": "ok",
"data": {
"uuid": "...",
"coins": {...},
"bills": {...},
...
}
}
puttransaction.php – Registrar venta
POST Registrar venta
/puttransaction.php
Solicitud
JSON
{
"transaction_id": "TX123456789",
"amount": 7595,
"user": "cajera1",
"terminal": "Puesto1",
"datetime": "2025-05-06 16:45:00",
"method": "efectivo"
}
gettransaction.php – ImaCash consulta transacción pendiente
GET Consultar transacción pendiente
/gettransaction.php
Respuesta
JSON
{
"status": "ok",
"transaction": {
"transaction_id": "...",
"amount": ...,
...
}
}
O si no hay:
JSON
{
"status": "ok",
"message": "Sin transacciones pendientes"
}
changestatustransaction.php – Confirmar transacción leída
POST Confirmar transacción leída
/changestatustransaction.php
Solicitud
JSON
{
"transaction_id": "TX123456789",
"denominations": { "5": 1, "10": 2 }
}
statustransaction.php – Ver estado de transacción
GET Ver estado de transacción
/statustransaction.php?transaction_id=TX123456789
Respuesta
JSON
{
"status": "ok",
"data": {
"status": "leido",
"denominations": { ... }
}
}
listtransactions.php – Historial de transacciones
GET Historial de transacciones
/listtransactions.php
Parámetros opcionales:
- status=pendiente o leido
- from=2025-05-01
- to=2025-05-06
putstatus.php – Enviar estado/error de máquina
POST Enviar estado/error
/putstatus.php
Solicitud
JSON
{
"uuid": "123e...",
"status": "error_billete",
"detail": "Atasco en validador",
"datetime": "2025-05-06 17:30:00"
}
getstatus.php – Obtener último estado
GET Obtener último estado
/getstatus.php?uuid=123e...
Respuesta
JSON
{
"status": "ok",
"data": {
"status": "error_billete",
...
}
}
getalerts.php – Consultar alertas activas
GET Consultar alertas activas
/getalerts.php
Parámetros: opcional uuid
putfill.php – Registrar rellenado de máquina
POST Registrar rellenado
/putfill.php
Solicitud
JSON
{
"uuid": "123e...",
"nombre_maquina": "Caja Central",
"currency": "EUR",
"datetime": "2025-05-06 19:15:00",
"coins": { "0.01": 50, "0.10": 100 },
"bills": { "5": 20, "10": 10 },
"total": 20000,
"user": "reponedor1"
}
getfills.php – Historial de rellenados
GET Historial de rellenados
/getfills.php
Parámetros opcionales: uuid, from, to
Respuesta
JSON
{
"status": "ok",
"data": [
{
"uuid": "...",
"total": 20000,
"coins": { ... },
"bills": { ... }
}
]
}