Skip to main content
The VivaWallet Cloud Terminal / ECR API lets a backend send card-present payment requests to physical POS terminals. The SDK exposes two layers for standard merchant integrations:
  • getCloudTerminalAccessToken() returns Viva’s raw Cloud Terminal token response so you can manage caching yourself.
  • vivawallet.pos wraps 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

Call getCloudTerminalAccessToken() when you need to call a Cloud Terminal endpoint not yet wrapped by the SDK.
Internally, this calls 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

Use searchDevices(options?) to list terminals available to the merchant credentials. You can filter by statusId or sourceCode.
Use terminalId from this response when creating sale, refund, action, or session-related requests.

Initiate a Sale Request

Use initiateSaleRequest(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

Use createAction(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:
List sessions for a date:
Abort an active session:

ISV POS

For ISV integrations, use the VivaISV 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. Use validateVivaPosSessionWebhook() from the Webhook Helpers guide when processing POS ECR session created or failed notifications.