Learn how to interact with Stax's integrated WiFi hardware terminals through the API for seamless payment processing and transaction management.
Overview
As a developer, use the Stax API to interact with your merchant account's integrated WiFi terminals and retrieve transaction data captured by those terminals. To see available devices, view supported point-of-sale devices.
Getting Started
GET /terminal/register returns the WiFi terminals belonging to your merchant account, including each terminal's id. These terminals are pre-configured for your merchant account, and no additional API resources are needed to set up the terminal for your account.
- Obtain your merchant API key. Send it in the
Authorizationheader asBearerfollowed by the key. The API uses JWT (JSON Web Token, a signed token that identifies your account) bearer authentication. - Call
GET /terminal/registerto retrieve your account's terminals. Read theidfrom the terminal you intend to use; for example,"4f1b-f10a"in the documented response. Use this value for theregisterfield in terminal operations, not the device'sserial,register_num, orstatus_port. - Choose an operation from the sections below. For a charge, save the returned transaction
idso you can check its status. An ID returned by the queued charge endpoint does not mean the payment has completed.
Optional: List terminals with Python
Run this read-only example before initiating a payment to confirm which terminals your API key can access. Install Python 3, save the code as list_terminals.py, and run python3 list_terminals.py. Enter your merchant API key at the prompt; the script does not echo it or store it in the source file.
The example uses these defaults:
- API base URL:
https://apiprod.fattlabs.com, withGET /terminal/registeras the read-only request. - Credentials: Enter your merchant API key at the hidden prompt rather than saving it in the source file.
- Dependencies: Use Python's standard library; no additional packages are required.
- Network behavior: Use a 30-second request timeout and no automatic retries.
- Device selection: List all returned terminals instead of automatically selecting a device that could be at the wrong checkout location.
import getpass
import json
import sys
import urllib.error
import urllib.request
def main():
api_key = getpass.getpass("Merchant API key: ").strip()
if not api_key:
print("Enter a merchant API key.", file=sys.stderr)
return 1
request = urllib.request.Request(
"https://apiprod.fattlabs.com/terminal/register",
headers={
"Authorization": f"Bearer {api_key}",
"Accept": "application/json",
},
method="GET",
)
try:
with urllib.request.urlopen(request, timeout=30) as response:
terminals = json.load(response)
except urllib.error.HTTPError as error:
print(f"Request failed: HTTP {error.code} {error.reason}", file=sys.stderr)
return 1
except (urllib.error.URLError, TimeoutError, OSError) as error:
print(f"Connection failed: {error}", file=sys.stderr)
return 1
except (ValueError, UnicodeError):
print("The API returned invalid JSON.", file=sys.stderr)
return 1
if not isinstance(terminals, list) or any(
not isinstance(terminal, dict) or not terminal.get("id")
for terminal in terminals
):
print("Unexpected terminal response; expected a list of devices with IDs.", file=sys.stderr)
return 1
if not terminals:
print("No terminals returned for this merchant account.")
return 0
# Copy the chosen device's ID from this API response, not its serial number.
print(json.dumps(terminals, indent=2))
return 0
if __name__ == "__main__":
sys.exit(main())On success, the script prints your terminals as a JSON array. This one-device example uses values from the documented response; your devices and IDs will differ:
[
{
"id": "4f1b-f10a",
"nickname": "Tech Area Z8 (3594291)",
"status_port": "3594291",
"serial": "124124",
"type": "dejavoo",
"model": "",
"isDefault": false,
"register_num": "3594291"
}
]If the script reports no terminals, confirm that the device is paired and enabled for your merchant account and that the account is activated for card-present processing (payments made with the card at the terminal). For HTTP 401 or 403, check that you supplied a valid key for the intended merchant account. For a connection failure, check your network connection before rerunning the read-only request.
Compliance responsibilities
Terminal features can support compliance efforts; they do not guarantee compliance. Confirm which compliance actions are required for your integration with your legal and compliance teams. The read-only terminal check above is a recommended integration check, not a compliance requirement.
Transaction Operations
Charging Transactions
POST /terminal/charge/queue - Initiates a charge to the terminal and returns an ID instantly, before the transaction is completed.
POST /terminal/charge - Requests the user to insert their card for a charge transaction.
Credit and Refund Operations
POST /terminal/credit - Requests the user to insert their card for a general credit transaction.
POST /terminal/void-or-refund - Requests either a void operation or prompts the customer to insert their card for a refund, depending on whether the transaction has been batched out. (RECOMMENDED)
POST /terminal/refund - Requests the user to insert their card for a refund transaction.
POST /terminal/void - Voids a transaction.
Terminal Interaction
POST /terminal/print - Prints a message on the terminal.
POST /terminal/promptInput - Requests the user to input text on the terminal.
POST /terminal/promptChoice - Requests the user to select from available choices on the terminal.
POST /terminal/prompt/signature - Requests the capture of a digital signature from the terminal.
Tokenization
Tokenization replaces card details with a reusable payment token so you can reference the payment method without handling the original card details.
POST /terminal/tokenize - Requests the customer to swipe their card to create a payment token without processing a charge.
Transaction Status
GET /terminal/{registerId}/status/{transactionId} - Returns the status of the transaction from the terminal itself and prints a receipt.
Obtain the identifiers from the API responses for the operation you initiated:
registerId(required string): Identify the terminal using theidreturned byGET /terminal/register. Terminal operation responses also include the internal ID asmeta.registerId; for example,"ba5c-5b03"in the queued charge example. Do not confuse this internal ID with the numericRegisterIdin the status response.transactionId(required string): Save the top-levelidfrom the charge response. For example, the documented queued charge response returns"71d7f9ec-59d9-4fab-891e-fa612cd2e275". Use the ID from your own transaction, not this example value.
For a queued charge, message: "terminalservice.waiting" means processing has not completed; do not treat that response as payment approval. Check the status response for success: true and review Message and RespMSG for the result. The documented approved response includes Message: "Approved". If the response reports "Transaction not found", check that the transaction ID belongs to the terminal you selected.
