getCloudTerminalAccessToken()returns Viva’s raw Cloud Terminal token response so you can manage caching yourself.vivawallet.poswraps common Cloud Terminal operations and requests a Cloud Terminal token internally for each SDK call.
Cloud Terminal credentials are separate from SmartCheckout credentials in many Viva setups. Use the Client ID and Client Secret intended for POS / Cloud Terminal access when calling these helpers.
Get a Cloud Terminal Access Token
CallgetCloudTerminalAccessToken() when you need to call a Cloud Terminal endpoint not yet wrapped by the SDK.
POST /connect/token with grant_type=client_credentials. The SDK does not cache this token; reuse it until expires_in seconds have elapsed, then request a new one.
A simple token-caching wrapper:
Standard POS Module
vivawallet.pos groups standard merchant Cloud Terminal helpers into three submodules:
Each wrapped method internally calls
getCloudTerminalAccessToken() and returns the SDK’s normal MethodReturn result. These calls do not share a token cache; add your own wrapper if your application needs token reuse across many POS requests.
Search POS Devices
UsesearchDevices(options?) to list terminals available to the merchant credentials. You can filter by statusId or sourceCode.
terminalId from this response when creating sale, refund, action, or session-related requests.
Initiate a Sale Request
UseinitiateSaleRequest(options) to send a payment request to a terminal. The SDK returns data: null when Viva accepts the asynchronous request; use session retrieval or webhooks to observe the final result.
POS Transaction Operations
The transaction helpers share the same base POS request shape:sessionId, terminalId, cashRegisterId, amount, currencyCode, and merchantReference, plus operation-specific fields.
Terminal Actions
UsecreateAction(options) for terminal actions such as aade-fim-control, then retrieve the action status with getActionDetails(options).
Retrieve and Abort Sessions
Retrieve one POS session by ID:ISV POS
For ISV integrations, use theVivaISV POS module instead. See ISV POS for vivaIsv.pos.devices, vivaIsv.pos.transactions, and vivaIsv.pos.session examples.
Webhook Follow-up
Cloud Terminal sessions can be followed through POS session webhooks. UsevalidateVivaPosSessionWebhook() from the Webhook Helpers guide when processing POS ECR session created or failed notifications.