Overview
This reference documents all shared data types used across both HTTP and WebSocket Terminal Gateway APIs.PaymentRequest
The payment request object used to initiate payments.string
Unique transaction identifier in UUIDv7 format. Use this to track and reconcile payments. Auto-generated if not provided.Example:
"01945f3d-a8c9-7000-8d45-6f8234ab9012"string | number
required
Payment amount. Can be a string (recommended for precision) or number.Example:
"99.99" or 99.99string
required
ISO 4217 currency code.Example:
"USD", "EUR", "PHP"string
required
Payment method type.Values:
CARD, CASH, MOBILE, OTHERProduct[]
Array of products in the transaction.
CustomerInfo
Customer information for the transaction.
object
Custom key-value pairs for your use. This data is stored with the transaction and returned in responses.Example:
Example
PaymentResponse
The payment response object returned when a payment completes.string
required
Transaction identifier matching your original request.
string
required
Payment status.Values:
SUCCESS, FAILED, PENDING, CANCELLEDstring | number
required
Payment amount.
string
required
Currency code.
string
required
Payment method used.
string
Authorization code from payment processor. Present on successful payments.Example:
"AUTH123456"string
Error code if status is
FAILED.Example: "INSUFFICIENT_FUNDS"string
Human-readable error message if status is
FAILED.Example: "Card declined due to insufficient funds"string
Opaque receipt data from terminal. Format depends on the terminal’s payment processor.
string
required
ISO 8601 timestamp of when the payment was processed.
object
Your custom metadata returned from the original request.
Successful Payment Example
Failed Payment Example
Product
Product item in a payment request.string
required
Product identifier.Example:
"PROD-001"string
required
Product name.Example:
"Widget"string | number
required
Unit price.Example:
"29.99"number
required
Quantity purchased.Example:
2string
Product category.Example:
"Electronics"string
Stock keeping unit.Example:
"WDG-001-BLK"string
Brand name.Example:
"Acme Corp"number
Tax amount for this item.Example:
2.99number
Discount amount for this item.Example:
5.00Example
CustomerInfo
Customer information for a payment.string
Customer identifier in your system.Example:
"CUST-123"string
Customer email address.Example:
"customer@example.com"string
Customer phone number.Example:
"+1-555-123-4567"Example
TerminalInfo
Terminal information returned when listing or querying terminals.string
required
Unique connection identifier. Changes when terminal reconnects.
string
required
Primary identifier. Uses
deviceId if available, otherwise connectionId.string
Stable device identifier. Configured via
X-Device-Id header on terminal connection. Persists across reconnections.string
required
ISO 8601 timestamp of when the terminal connected.
string
required
ISO 8601 timestamp of the terminal’s last activity.
string
required
Terminal status.Values:
online, offline, reconnectingobject
Custom terminal metadata.
Example
TransactionRecord
Transaction record returned when querying transaction status (HTTP API).string
required
Unique transaction identifier.
string
required
Transaction status.Values:
PENDING, COMPLETED, FAILED, CANCELLED, AWAITING_RECONNECT, VOIDEDPaymentRequest
required
Original payment request.
PaymentResponse
Payment response (if completed).
string
required
ISO 8601 timestamp of creation.
string
required
ISO 8601 timestamp of last update.
string
ISO 8601 timestamp of completion (if applicable).
string
Stable terminal device identifier (if available).
string
ISO 8601 timestamp when payment was voided (if applicable).
string
Reason for voiding the payment (if voided).
string
required
ISO 8601 timestamp of this response.
Example
VoidResult
The result returned when a void operation is performed.boolean
required
Whether the void operation succeeded.
string
required
The transaction that was voided.
string
required
Reason for the void.Example:
"Terminal reconnected after grace period"string
ISO 8601 timestamp of when the payment was voided.Example:
"2024-01-15T10:38:30.000Z"string
Error message if the void operation failed.Example:
"Transaction already voided"Example
Metadata Field
Themetadata field allows you to attach custom data to payments. This data is stored with the transaction and returned in responses.
Use Cases
The
metadata field accepts any valid JSON object. Keys and values should be strings, numbers, or booleans for best compatibility.Payment Status Definitions
Transaction Status
Payment Response Status
HTTP Error Reference
Error Response Format
All HTTP API errors follow this format:Error Codes
WebSocket Error Reference
Error Message Format
WebSocket errors follow this format:Common Errors
forceDisconnect Reasons
Currency Codes
The API uses ISO 4217 three-letter currency codes:Contact support@moduluslabs.io for the complete list of supported currencies for your integration.
System Constants
Important timeouts and limits to consider when integrating with Terminal Gateway.If a terminal disconnects mid-payment, the system waits up to 60 seconds for reconnection. If the terminal reconnects with a successful payment after this grace period, the payment is automatically voided.
WebhookEndpoint
Configuration object for a webhook endpoint.string
required
Unique identifier for the webhook endpoint.Example:
"wh_01HQ3K4M5N6P7R8S9T0UVWXYZ"string
required
The HTTPS URL where webhook payloads are delivered.Example:
"https://api.yourcompany.com/webhooks/payments"string[]
required
Event types this endpoint is subscribed to.Values:
payment.completed, payment.failed, payment.cancelled, payment.timeoutstring
Human-readable description for this endpoint.Example:
"Production payment notifications"string
Webhook signing secret for verifying payloads. Only returned on endpoint creation.Example:
"whsec_abc123xyz789..."string
required
Endpoint status.Values:
active, disabledobject
Custom key-value pairs associated with this endpoint.
string
required
ISO 8601 timestamp of when the endpoint was created.
string
required
ISO 8601 timestamp of the last update.
Example
WebhookPayload
Payload delivered to your webhook endpoint when a payment event occurs.string
required
The type of event that triggered this webhook.Values:
payment.completed, payment.failed, payment.cancelled, payment.timeoutstring
required
Unique identifier for this event. Use for idempotency checks.Example:
"evt_01HQ3K4M5N6P7R8S9T0UVWXYZ"string
required
ISO 8601 timestamp of when the event occurred.
object
required
Event-specific payload data containing the payment result.
Example
WebhookEventType
Event types that can trigger webhook notifications.Payment Methods
Supported payment method values:Timestamps
All timestamps in the API use ISO 8601 format with UTC timezone:Parsing Timestamps
Next Steps
Authentication
Learn about API authentication methods
Core Concepts
Understand device enforcement and reconnection resilience
HTTP Endpoints
Complete HTTP endpoint reference
WebSocket Actions
WebSocket commands reference