Transactions

Transactions represent financial activities within the Stax API. A transaction signifies an exchange of money between a merchant and a customer and is associated with a payment_method and customer.

Use the Stax API to retrieve transactions, send receipts, and manage voids and refunds.

Create payment transactions with POST /charge, then use the operations below to manage them. This page is for developers integrating with the API.

Prepare your request

  1. Obtain a merchant API key and use it as a Bearer token in the Authorization header. Keep it out of client-side code and public repositories.
  2. Confirm that your merchant team is active and enabled.
  3. Copy the transaction's id from an existing transaction response. For example, "6f49149d-69a1-48e6-bec5-d63eb5816118" shows the UUID format; replace it with an ID belonging to your merchant account.

Retrieve a transaction

Run this example with Python 3. It uses only the standard library and prompts for your API key without displaying it. Use a sandbox API key for testing; sandbox and live keys use the same base URL, but sandbox payments do not use real money.

import getpass
import json
import socket
import sys
from urllib.error import HTTPError, URLError
from urllib.parse import quote
from urllib.request import Request, urlopen


def main():
    api_key = getpass.getpass("Merchant API key: ").strip()
    # Copy the id from an existing transaction response for this merchant.
    transaction_id = input("Transaction ID: ").strip()
    if not api_key or not transaction_id:
        sys.exit("Provide both an API key and a transaction ID.")

    request = Request(
        "https://apiprod.fattlabs.com/transaction/"
        + quote(transaction_id, safe=""),
        headers={
            "Authorization": "Bearer " + api_key,
            "Accept": "application/json",
            "Content-Type": "application/json",
        },
        method="GET",
    )
    try:
        with urlopen(request, timeout=30) as response:
            transaction = json.load(response)
    except HTTPError as error:
        if error.code == 401:
            sys.exit("Authentication failed. Check your merchant API key.")
        if error.code in (404, 422):
            sys.exit("Check that the transaction ID belongs to this merchant.")
        sys.exit(f"Request failed with HTTP {error.code}.")
    except (URLError, TimeoutError, socket.timeout) as error:
        sys.exit(f"Connection failed: {error}")
    except (ValueError, UnicodeError):
        sys.exit("The API did not return valid JSON.")

    if not isinstance(transaction, dict) or not transaction.get("id"):
        sys.exit("The response did not contain a transaction ID.")
    print(json.dumps({key: transaction.get(key) for key in (
        "id", "type", "success", "is_refundable", "is_voidable"
    )}, indent=2))
    if transaction.get("success") is False:
        print("The lookup succeeded, but the payment was unsuccessful.")
    if not transaction.get("is_refundable") and not transaction.get("is_voidable"):
        print("Neither a refund nor a void is currently available.")


if __name__ == "__main__":
    main()

For the transaction in the endpoint's documented response, the script prints:

{
  "id": "6f49149d-69a1-48e6-bec5-d63eb5816118",
  "type": "charge",
  "success": true,
  "is_refundable": false,
  "is_voidable": true
}

Your values depend on the transaction you retrieve. A successful lookup returns transaction details; it does not mean the original payment succeeded. Check success separately, and check is_refundable and is_voidable before attempting a refund or void.

Core Transaction Operations

List & Filter Transactions

Retrieve all transactions associated with a merchant account with query parameters to sort and filter transaction data.

Requirements: Authentication Token, Active Team, and Enabled Team

Get Transaction Details

Retrieve detailed information about a specific transaction using its unique ID, including payment method, customer details, and child transactions.

Requirements: Authentication Token, Active Team, and Enabled Team

Update Transaction

Update details of manually created transactions. Do not use this operation for transactions created by Stax from invoices or POST /charge.

Requirements: Authentication Token, Active Team, and Enabled Team

Transaction Communication

Email Receipt

Send an email receipt for a transaction to the customer's email on file, with option to send copies to additional addresses.

Requirements: Authentication Token, Active Team, and Enabled Team

SMS Receipt

Send a transaction receipt via SMS to the customer. Enable the SMS receipt feature for your account before using this operation.

Requirements: Authentication Token, Active Team, and Enabled Team

Transaction Management

Void or Refund a Transaction

Handle transaction reversals based on current status:

Batching groups transactions for processing. Settlement is the process of transferring payment funds through the payment network; it is not the same as batching.

  • Void: Cancel a transaction before batching and settlement. Check is_voidable before requesting a void.
  • Refund: Return funds to the customer after batching. Check is_refundable before requesting a refund. You can refund part of the original amount.

Key Points:

  • Transactions typically batch around 8 pm EST
  • Use the is_refundable flag to determine refund eligibility
  • Partial refunds require specifying amount in request body
  • Partial voids are not supported

Requirements: Authentication Token, Active Team, and Enabled Team

Best Practices & Important Notes

Authentication Requirements

Include your merchant API key as a Bearer token in the Authorization header for every transaction request. Confirm that your merchant team is active and enabled. These are required for the operations on this page; using a sandbox key first is recommended for testing.

shieldSuspected-Fraud Filtering

GET /transaction excludes suspected-fraud transactions by default

Transactions that Stax has flagged as suspected fraud (is_suspected_fraud) are excluded from GET /transaction results by default — they will not appear in a normal list/filter call, and are also excluded from exports and revenue-reporting aggregates.

  • Pass is_suspected_fraud=1 (or true) to include flagged transactions in the results alongside unflagged ones.
  • Pass is_suspected_fraud=0 to explicitly request only unflagged transactions (same as the default).
  • A flagged transaction is never deleted and remains reachable via GET /transaction/{id} regardless of this filter. Here, {id} is route notation: replace it with the transaction's actual id, without braces, as the Python example does.
  • Only failed charges can be flagged, so a flagged transaction never carries revenue from settlement (the transfer of payment funds through the payment network).

If your integration expects a complete transaction history, be aware that a small number of rows may be silently absent from default GET /transaction calls when Stax has flagged them as suspected fraud.

Timing Considerations

Voids and Refunds Timing

  • Be aware of batching times for transactions
  • Voids must be performed before a transaction is batched
  • Refunds can only be performed after batching
  • In sandbox accounts, transactions may not be refundable until 12 am EST

Optional: Enable Settlement Tokenization

Settlement Tokenization creates a reusable card reference after settlement (the transfer of payment funds through the payment network). Tokenization means using a reference to stored card details rather than submitting those details again. This feature lets you reuse a card presented at an integrated terminal for later payments or refunds without the original terminal.

  • Contact support to enroll before using this feature.
  • Wait until the card reference becomes available, usually the next business day.
  • Check is_cnp_refundable to determine whether a refund without the card present is available; do not assume it is available immediately after an in-person payment.
Transaction Modifications

Updating Transactions

  • Exercise caution when updating transaction data, especially within the meta object
  • Modifications may affect receipts, invoices, and integrations like QuickBooks Online
  • Only manually created transactions can be updated

Partial Operations

  • Partial refunds: Specify amount in request body
  • Full refunds: Can be performed without specifying amount
  • Partial voids: Not supported
Error Handling & Testing

Error Handling
Implement robust error handling to capture:

  • Invalid transaction IDs
  • Authorization failures
  • Validation errors

Testing Environment

  • Sandbox behavior may differ from production
  • Certain refund behaviors may be different in testing
  • Contact support for feature enablement questions