Overview
This guide walks you through making your first HTTP API requests to discover terminals, initiate a payment, and check transaction status.Prerequisites
Before you begin, ensure you have:API Credentials
API key and API secret provided by Modulus Labs
HTTP Client
cURL, Postman, or HTTP client library for your language
JSON Parser
Ability to parse JSON responses
Network Access
Outbound HTTPS access to the API endpoint
Quickstart Flow
Step-by-Step Guide
1
Set up authentication
The HTTP API uses HMAC-SHA256 authentication. Each request requires three headers:
See the Authentication page for detailed signature computation.
2
Discover available terminals
List all connected terminals in your group:Response:
cURL
3
Initiate a payment
Send a payment request to a terminal. This endpoint uses long-polling and waits up to 90 seconds for the terminal to respond.Successful Response (200 OK):
transactionId is optional. If you supply one, it must be a UUID v7; otherwise the request fails with 400 INVALID_REQUEST. Omit it and the gateway generates one, which you read from the response.cURL
4
Check transaction status (optional)
If a payment times out or you need to verify status later:Response:
cURL
Complete Code Examples
Error Handling
Errors return a JSON body witherror, message, and requestId. Most also include a code you can branch on; the exceptions are noted below.
Authentication Errors (401)
Authentication Errors (401)
A
401 has no code field. Read message instead:Request Errors (400)
Request Errors (400)
Terminal Errors (403, 502, 503)
Terminal Errors (403, 502, 503)
Payment Errors (202, 409, 504)
Payment Errors (202, 409, 504)
Transaction Errors (403, 404)
Transaction Errors (403, 404)
Recovering from a timeout
A504 means the gateway did not hear back from the terminal in time, not that the payment failed. The customer may have completed it on the device.
- Do not retry the payment immediately - you risk charging twice.
- Call
GET /v1/transactions/{transactionId}to read the real status. - Only retry when the transaction record’s status is
FailedorCancelled.
GET /v1/terminals before you charge.
Next Steps
API Reference
Full request and response schemas for every endpoint
Authentication
Detailed HMAC signature guide
Core Concepts
Device enforcement and reconnection
WebSocket API
Real-time terminal events and notifications