TheDocumentation 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.
/api/v1/payments/pagar-conekta endpoint is the core transaction flow for Conekta-powered captive portals. It accepts a Conekta.js card token from the browser, creates a MikroTik Hotspot user with the appropriate profile, charges the card, and returns ready-to-use WiFi credentials. The entire process is atomic from the user’s perspective — if the payment is declined or fails, the hotspot user is immediately deleted so no access is granted without a successful charge.
Create-first, charge-second design: The MikroTik hotspot user is created before the Conekta charge is attempted. If the card charge fails for any reason (declined, expired, network error), the hotspot user is automatically deleted (rolled back) before the error is returned to the client. This ensures no free access is ever granted on a failed payment.
Request
Method:POSTPath:
/api/v1/payments/pagar-conektaContent-Type:
application/json
Headers
Router API Key in the format
jwt_<token>. Identifies the company (providing Conekta credentials) and the router (providing MikroTik credentials).Body
The request body accepts both the canonical field names (Python) and their Spanish aliases. Both are shown below. Either form is accepted.The ID of the product to purchase. Obtain this from
GET /api/v1/catalogo_perfiles_venta. Also accepted as product_id.Card tokenization token generated by Conekta.js (
conekta.Token.create). This token is single-use and expires shortly after creation. Also accepted as card_token.Full name of the cardholder, passed to Conekta for order creation. Also accepted as
customer_name.Valid email address of the customer. Used for Conekta order creation and stored in the transaction record. Must be a valid email format. Also accepted as
customer_email.Customer phone number. Optional — passed to Conekta as additional customer info. Also accepted as
customer_phone.Controls the type of credentials generated for the MikroTik hotspot user. Also accepted as
user_type."usuario_contrasena"— (default) Generates a short alphanumeric username (e.g.,"AB3C9D") and a separate numeric password (e.g.,"1234"). The user logs in with both."pin"— Generates a single 6-digit numeric PIN. The username is the PIN itself, and the password field is empty. Suitable for simpler captive portal flows.
"usuario_contrasena".MAC address of the client device (e.g.,
"AA:BB:CC:DD:EE:FF"). Required if conexion_automatica is true. Used to bind the new hotspot user to the device’s MAC and attempt automatic login via MikroTik’s cookie injection mechanism. Also accepted as mac_address.Current IP address of the client device on the captive portal network. Used during auto-connection to target the correct active session. Also accepted as
ip_address.Free-form device information string (e.g., user-agent, device model). Stored in transaction metadata for analytics. Also accepted as
device_info.When
true, the server will attempt to automatically authenticate the client device on the MikroTik hotspot immediately after a successful payment, using mac_cliente and ip_cliente. The connection result is reported in the auto_conexion field of the response. Also accepted as auto_connect.If mac_cliente is not provided, this flag is ignored.Response
On success the endpoint returnsHTTP 200 with the following JSON body.
Always
true on a successful response.Conekta Order ID (e.g.,
"ord_2tV7dXbYzS3kLmNp"). Store this for support and reconciliation purposes.Payment status. Always
"paid" in a success response. Any other status is treated as an error and results in a 402 response.The user type that was actually used to create the hotspot credentials. Either
"usuario_contrasena" or "pin".The WiFi credentials to display to the user.
Summary of the product that was purchased.
Customer information as submitted in the request.
ISO 8601 UTC datetime of when the transaction was completed (e.g.,
"2024-07-01T15:30:45.123456").Result of the automatic connection attempt. Present in all responses regardless of whether
conexion_automatica was requested.Payment Flow
Examples
cURL
Success Response 200 OK
Error Response 402 Payment Required (card declined)
Error Response 404 Not Found (invalid product)
Error Codes
| Status | Trigger |
|---|---|
402 Payment Required | Card declined, payment expired, cancelled, pre-authorized, or any non-paid status returned by Conekta. |
404 Not Found | producto_id does not exist or does not belong to the authenticated company. |
500 Internal Server Error | Failed to create the MikroTik hotspot user, unexpected Conekta error, or internal server fault. |