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
Quick Start Flow
Step-by-Step Guide
Set up authentication
The HTTP API uses HMAC-SHA256 authentication. Each request requires three headers:
See the Authentication page for detailed signature computation.
| Header | Description |
|---|---|
x-api-key | Your API key |
x-timestamp | ISO 8601 timestamp |
x-signature | Base64-encoded HMAC-SHA256 signature |
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):
cURL
Complete Code Examples
Error Handling
Handle common error scenarios:Authentication Errors (401)
Authentication Errors (401)
| Code | Cause | Solution |
|---|---|---|
UNAUTHORIZED | Invalid API key | Verify your API key |
INVALID_SIGNATURE | Signature mismatch | Check signature computation |
TIMESTAMP_EXPIRED | Timestamp too old | Sync system clock |
Terminal Errors (404, 503)
Terminal Errors (404, 503)
| Code | Cause | Solution |
|---|---|---|
TERMINAL_NOT_FOUND | Terminal doesn’t exist | Refresh terminal list |
TERMINAL_OFFLINE | Terminal disconnected | Wait for reconnection |
Payment Errors (409, 504)
Payment Errors (409, 504)
| Code | Cause | Solution |
|---|---|---|
PAYMENT_IN_PROGRESS | Another payment active | Wait for completion |
TIMEOUT | No response in 90s | Check transaction status |