This guide walks you through the minimal end-to-end flow: fetching the product catalog, submitting a card payment, and extracting the MikroTik Hotspot credentials from the response. You’ll need a running server and a valid router API Key — if you haven’t set those up yet, follow the Installation guide first.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sistemashm24/pagos_hotspot_api/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure you have:- A running instance of Pagos Hotspot API (see Installation)
- A PostgreSQL database with migrations applied (
alembic upgrade head) - A router API Key (
jwt_...) generated viaPOST /admin/empresas/{id}/routers - A Conekta test account with a configured private key on your company
All three public-facing endpoints shown in this guide require the
X-API-Key header. The key is a JWT prefixed with jwt_ and is scoped to exactly one router and one company.Minimal End-to-End Flow
Fetch the Product Catalog
Call Example response:Note the
GET /api/v1/catalogo_perfiles_venta to retrieve the access plans your company has configured. This is the same call your captive portal HTML makes to build the product selection screen.id of the plan the customer selects — you’ll pass it as producto_id in the next step.Process a Payment
Call Full list of request fields:
POST /api/v1/payments/pagar-conekta with the card token returned by Conekta.js, the selected producto_id, and basic customer information.| Field | Type | Required | Description |
|---|---|---|---|
producto_id | integer | ✅ Yes | ID from the product catalog |
token_tarjeta | string | ✅ Yes | Card token from Conekta.js |
nombre_cliente | string | ✅ Yes | Customer full name |
email_cliente | string | ✅ Yes | Valid customer email |
telefono_cliente | string | No | Customer phone number |
mac_cliente | string | No | Device MAC address for auto-connect |
ip_cliente | string | No | Device IP address for auto-connect |
info_dispositivo | string | No | Free-form device description or user-agent string |
conexion_automatica | boolean | No | Attempt MAC auto-login (default: false) |
tipo_usuario | string | No | "usuario_contrasena" (default) or "pin" |
Interpret the Response
On success, the API returns HTTP The fields your captive portal needs to display to the user are:
200 with a JSON body containing the MikroTik credentials, transaction details, product information, and auto-connection status.usuario_hotspot.usuario— the Hotspot username to enter in the login formusuario_hotspot.contrasena— the Hotspot passwordauto_conexion.estado—"conectado"if MAC auto-login succeeded,"no_conectado"otherwiseauto_conexion.mensaje— human-readable connection status message for the customer
tipo_usuario is "pin", the API generates a 6-digit numeric PIN stored in usuario_hotspot.usuario and usuario_hotspot.contrasena will be the same value. Present only the PIN to the user in that case.Enable Auto-Connection (Optional)
If the customer’s device is already visible in the MikroTik Hotspot host table (i.e., they are on the WiFi network), you can skip the credentials screen entirely by setting When auto-connection succeeds, the response includes:Requirements for auto-connection to work:
conexion_automatica: true and passing the device MAC address.- The device MAC must be present in
/ip/hotspot/hoston the router at the time of the request - A valid
mac_clientemust be passed in the request body conexion_automaticamust betrue
Test Card Numbers
Use the following Conekta test cards in your sandbox environment. These tokens will always return a successful
Generate a card token by calling
paid status and never charge a real card.| Network | Number | CVV | Expiry |
|---|---|---|---|
| Visa | 4242 4242 4242 4242 | 123 | Any future date |
Conekta.js with the test card number before sending the payment request. The resulting token_tarjeta value looks like tok_test_....Handling Errors
If the payment is declined or the router is unreachable, the API returns a non-2xx status with a JSONdetail field:
| HTTP Status | Meaning |
|---|---|
402 | Payment rejected by the gateway (card declined, insufficient funds, etc.) |
404 | Product not found or does not belong to this company |
401 | Invalid, expired, or revoked API Key |
500 | Internal server error — MikroTik unreachable or unexpected failure |