Here you can find information about the two authentication types used for connection to our APIs.

Basic authentication

Once you’ve created an account with Viva Wallet, you can use basic authentication to implement our Redirect Checkout, Payment API or Wallet API.

Basic Authentication offers basic security. Your credentials are not encrypted or hashed; they are Base64-encoded only.

How to authenticate using basic auth

With basic authentication, you pass your Viva Wallet credentials (Merchant ID and API Key) in each request to our APIs. You can pass your credentials as a Base64-encoded header or as parameters in an HTTP call.

If using Postman, under Authorization you select Basic Auth and enter the following:

When you pass your credentials in the header, you must Base64-encode them. The following is an example of an encoded HTTP basic authentication header:

Authorization: Basic ZmJmMWUwOTAtNjVkZS00Yzc1LWI1ODAtZDlkOWJjNDk0YWQyOldEdi1WKw==

With a client such as cURL, you pass your encoded credentials in the header with the -H option, as the following example shows:

curl -X POST \ \
  -H 'Authorization: Basic ZmJmMWUwOTAtNjVkZS00Yzc1LWI1ODAtZDlkOWJjNDk0YWQyOldEdi1WKw==' \
  -H 'Content-Type: application/json' \
  -d '{
  "Tags": [
    "sample string 1",
    "sample string 2",
    "sample string 3"
  "Email": "",
  "Phone": "2117604000",
  "FullName": "Customer name",
  "PaymentTimeOut": 86400,
  "RequestLang": "en-GB",
  "MaxInstallments": 12,
  "AllowRecurring": true,
  "IsPreAuth": true,
  "amount": 100,
  "MerchantTrns": "Your reference",
  "CustomerTrns": "Description that the customer sees"

Running the above from the command line should result in a response containing an order code generated by the Create payment order call from our Payment API.

IdentityServer (OAuth 2) authentication

Viva Wallet’s Native Checkout v2, Card Tokenization API, Obligations API and Issuing API use IdentityServer (OAuth 2) for authentication. We obtain consent securely from customers and ensures the integrity and confidentiality of the personalised security credentials and of authentication codes.

sequenceDiagram participant Client participant IdentityServer participant User Client->>IdentityServer:authorize request loop User login IdentityServer->>User: Login prompt User-->>IdentityServer: Login end IdentityServer-->>Client:authorization code Client->>IdentityServer:token request Note left of Client: ID Token
Access Token IdentityServer-->>Client:token response

Logging in to an application is performed by a redirection to our Viva Payments Identity Server (OAuth 2 specification) in which the user provides their credentials through a secure channel (HTTPS). Redirection ensures that no malicious client-side scripting can run on the page, and no other client-side script can access the contents of the log-in page.

Environment Endpoint

IdentityServer is an OpenID Connect Provider. It is used to:

OAuth 2 token generation

Follow the steps below to generate a bearer token for use with our APIs. The token has a time limit of one hour after which it expires. The overall process is as follows:

  1. Get client credentials
  2. Request access token
  3. Receive access token
  4. Make calls to the API using the access token

Step 1: Get client credentials

Before you can request an access token, you need to obtain client credentials from Viva Wallet. To do this:

  1. Log in to Viva Wallet, demo or live , and select the required account.

  2. Click on Settings in the left navigation:

    Settings Menu

  3. Click on API Access:

    API Access Page

  4. Find the Native Checkout v2 Credentials section within the page:

    Access Credentials

  5. Copy and paste your Client ID and Client Secret to a temporary location.

Step 2: Request access token

Resource access is allowed to clients only with the use of access tokens. The first step before issuing any calls to the Viva Payments API is to obtain an access token by making a POST request.

Before proceeding you need to encode the client credentials (with no spaces and separated by a colon):

[Client ID]:[Client Secret]

into Base64 format. This gives a result such as:


You can then use in your request as shown in the below cURL example:

 curl --location --request POST '' \
 --header 'Content-Type: application/x-www-form-urlencoded' \
 --header 'Authorization: Basic ZzI0N2NmbnlwYzV3cmszaHAwZnU2cTk3N2YzZzYxY2hnODV1NzJzZmJkb3c3LmFwcHMudml2YXBheW1lbnRzLmNvbTpTODUySjE4RDkzTDJzZDJKbU8xWG1iOU02eWg2NlU=' \
 --data-urlencode 'grant_type=client_credentials'

Step 3: Receive access token

After successful authentication, the identity server will respond by providing the access token requested:

{"access_token":"7e53b85b7a1de2a1e777729b925b877c3636124c0ff57bfa2f54021c279ecc2e","expires_in":3600,"token_type":"Bearer","scope":"urn:viva:payments:core:api:acquiring urn:viva:payments:core:api:acquiring:cards:tokens urn:viva:payments:core:api:nativecheckoutv2"}

The token lasts for 3600 seconds which equates to one hour, after which you need to request a new one.

Step 4: Make calls to the API using the access token

From now on, the client can access API resources with the use of the access token until it expires and needs renewal. Subsequent calls to the API must include the access token at the authorization header with bearer instead of basic selected.

Further information

Check out the related tutorials below for more details about basic / OAuth 2 authentication: