Merchant sessions and terminals
Your app signs the merchant in, renews the token and selects the terminal. The POS SDK checks that the supplied session can use that merchant and branch.
Obtain and renew the merchant grant
Use the host's approved BFF sign-in and renewal flow described in Consumer sessions, with merchant credentials and the permitted merchant/branch role.
| BFF response | POS use |
|---|---|
accessToken | Pass to POS applySession |
expiry | Remaining lifetime in seconds |
id | Keep in the host authentication flow for BFF renewal; do not pass it to POS |
The host renews through POST /proxy/v1/refresh?authorizationId=… and supplies the current token again. Native token acceptance does not prove permission for every backend endpoint; Bluetooth session creation has its own role checks. Obtain the original terminal record through provisioning instead of generating replacement IDs.
Supply a session
sdk.applySession(accessToken, expirySeconds)The call is synchronous; run it off the UI thread. Pass the remaining token lifetime in seconds, not an epoch timestamp. The SDK uses the earlier of that lifetime and JWT exp, when present.
Tokens are held in memory. Supply a session again after process restart. POS has no hosted login, token refresh or automatic HTTP 401 retry.
| JWT subject type | Merchant binding | Branch requirement |
|---|---|---|
MERCHANT | sub_id | Selected merchant must match |
MERCHANT_ADMINISTRATOR | org_id | Selected merchant must match |
MERCHANT_BRANCH_ADMINISTRATOR | org_id | Selected branch must be in sub_org_ids |
MERCHANT_BRANCH_SALES_CLERK | org_id | Selected branch must be in sub_org_ids |
Inactive-subject markers sdt and ddt are rejected. Local parsing checks context and expiry; the server still verifies JWT authenticity and endpoint permissions.
Select the terminal
Pass the merchant ID, branch ID, POS ID, original terminal serial, device name and full capability set in PosTerminal. See the POS quickstart for the call.
Supported capability values are NFC, BAAS, CARD_SERVICING, TERMINAL_MODE and FULL_MODE. Preserve capabilities used by other payment methods. Bluetooth does not introduce a new backend capability value.
The NFC reader requires NFC and BAAS. A Bluetooth source requires BAAS. Your app discovers hardware and requests permissions; the SDK does not query SoftPay or obtain location.
Ensure device association
val registered = withContext(Dispatchers.IO) { sdk.ensureDeviceAssociation() }The SDK reads the association using the original serial. Only a confirmed HTTP 404 permits creation, followed by another read. Other errors propagate.
Check the returned capabilities before accepting payments. An existing association is not overwritten. Wollette must supply a supported process for resolving capability mismatches; no update route is established by this SDK.
Renew or change context
Renewing a token for the same subject, role and merchant keeps terminal context and keys if branch access remains valid. An in-flight response may complete under that renewed context.
Changing subject identity, merchant or branch access clears selected context and keys. Selecting another merchant, branch, POS or serial clears the previous context's key. Late key responses cannot be installed into the new context.
A context change can stop local work after the server has already acted. Payment results use the separate durable recovery rules.
Sign out
Cancel the screen's operation, then clear POS state:
sdk.cancelOperation()
withContext(Dispatchers.IO) { sdk.clear() }The example uses the coroutine imports from the quickstart.
clear() invalidates the in-memory session/context before deleting this POS key namespace. It retains the financial journal. It does not clear consumer SDK state or your app's own credentials/storage.
Report storage failures. To recover an outstanding operation after sign-in, supply an allowed merchant session and select the original merchant, branch, POS and serial. A different terminal cannot take over the retained operation.
Keep one instance per namespace. Concurrent protected work can return OPERATION_IN_PROGRESS; let the running operation finish or cancel before starting another.
Verify the first association
An association-only first API test requires a current merchant session, original terminal identity/capabilities and stable API/storage configuration. It does not require payer hardware, an order or a payment key. Display the returned serial and compare capabilities; existing records are not silently updated.
Keep a single SDK owner per namespace. The copyable association components are alternative service examples; avoid adding another wrapper beside the SDK already retained by a starter. After restart restore the original context and inspect the financial journal before key maintenance or payment.