kepa
WebSocket Stream/openSession

Open a Session

Stream transaction lifecycle events in real time.

WS/v1/session
Open a WebSocket to drive transactions and stream their lifecycle in real time. Send JSON action messages — sale, pre_auth, card_read, complete, display, input, abort — and receive a sequence of typed events as the transaction progresses. Events are a discriminated union on the event field, so a single switch statement is enough to drive your POS UI from waiting_for_card all the way through to result. The session is designed to survive flaky networks: the terminal keeps running its transaction even if the POS disconnects, and a resume token lets the POS reconnect and pick up the event stream exactly where it left off.
Sale lifecycle
~5–15 seconds
What happens after a single POST /v1/transaction/sale. Each step is also emitted as a WebSocket event if you connect a session in parallel.
POS sends salePOST /transaction/sale01Readywaiting_for_card02Tap detectedcard_detected03Authorizingprocessing04Approvedresult05

Request body

application/json

actionenumrequired

The action to initiate.

salepre_authcard_readcompletedisplayinputabort
amountinteger

Required for sale/pre_auth.

currencystring

Required for sale/pre_auth.

entryModeenum

Optional card entry mode.

CONTACTLESSCONTACTAUTO
referenceIdstring

POS-assigned reference identifier.

granularboolean

Set true to run in granular mode and receive online_authorization events.

transactionIdstring

Required for complete and abort.

responseCodestring

ISO 8583 response code (complete action).

authorizationCodestring

Issuer auth code (complete action).

commerce-api/openapi.yaml · openSession

WSLocal
http://terminal:8443/v1/session
Request
# Connect with websocat (https://github.com/vi/websocat)
export ATLAS_API_KEY="sk_live_..."
websocat "ws://terminal:8443/v1/session?apiKey=$ATLAS_API_KEY" \
  <<< '{"action":"sale","amount":2500,"currency":"NZD"}'
Response
{ "event": "waiting_for_card", "transactionId": "txn_01J...", "message": "Present card" }
{ "event": "card_detected", "transactionId": "txn_01J...", "entryMode": "CONTACTLESS", "scheme": "VISA", "maskedPan": "****1234" }
{ "event": "processing", "transactionId": "txn_01J...", "message": "Authorizing" }
{ "event": "result", "response": { "transactionId": "txn_01J...", "status": "APPROVED", "amount": 2500, "currency": "NZD" } }