Skip to main content
Vivawallet is the primary client class for standard merchant integrations. It exposes typed sub-client modules for payments, transactions, webhooks, fees, wallets, bank transfers, data services, POS helpers, resellers, RF code payments, obligations, source codes, and legacy bank accounts.

Constructor

Import and instantiate the client with your VivaWallet credentials:
clientId
string
required
OAuth 2.0 Client ID used to request Bearer tokens.
clientSecret
string
required
OAuth 2.0 Client Secret paired with clientId for token requests.
merchantId
string
required
Merchant UUID used as the username in Viva Basic Auth requests.
apikey
string
required
API key used as the password in Viva Basic Auth requests.
sourceCode
string | null
Stored on the client for source-code helpers. Pass source codes in method options when a payment or transaction endpoint requires one.
dev
boolean
default:"false"
When true, the client uses VivaWallet demo endpoints for API calls.
logs
boolean
default:"false"
Enables internal SDK error logging when true.

Sub-client Modules

Each module is available as a property on the Vivawallet instance and handles one domain of the VivaWallet API.

Methods

getCloudTerminalAccessToken()

Calls POST /connect/token with grant_type=client_credentials and returns VivaWallet’s full token response. The SDK does not cache this token; callers should reuse it until expires_in elapses.

getVivaWebhookCode()

Deprecated wrapper around webhooks.retrieveWebhookKey().

getSmartCheckout(options)

A standalone named export, not a method on the class. It builds the full SmartCheckout redirect URL for a given order code.
Signature:
orderCode
string
required
The order code returned by payments.createOrder(), converted to a string.
color
string
Optional color value appended to the SmartCheckout URL.
paymentMethod
number
Optional VivaWallet payment method identifier to pre-select on SmartCheckout.
dev
boolean
default:"false"
When true, constructs a URL pointing to the VivaWallet demo checkout environment.
Returns: string — the fully constructed SmartCheckout redirect URL.