Enable basic auth

Applicable to Redirect Checkout, Payment API and Wallet API calls.

Step 1: Find your Viva Wallet access credentials

To authenticate with basic auth you need firstly to find your Viva Wallet access credentials (Merchant ID and API Key) in the Viva Wallet banking app. To do this:

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

  2. Go to Settings > API Access in the left navigation.

  3. You’ll find your Merchant ID and API Key in the Access Credentials section at the top of the page:

    Access Credentials

  4. Copy and paste your Merchant ID and API Key to a temporary secure location.

Step 2: Use your access credentials in an API call

In the examples below, there are two ways in which the Viva Wallet access credentials are used:

Directly in Postman

Authorization tab in Postman with Basic Auth selected from Type dropdown:

Access Credentials

As Base64 value in cURL and PHP

curl -L -X POST 'https://demo.vivapayments.com/api/orders' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic [Base64-encoded Merchant ID and API key]' \
--data-raw '{
  "amount": 100,
  "email": "customer@domain.com",
  "fullName": "Customer name",
  "customerTrns": "Short description of items/services purchased to display to your customer",
  "requestLang": "en-GB"
}'

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://demo.vivapayments.com/api/orders',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
  "amount": 100,
  "email": "customer@domain.com",
  "fullName": "Customer name",
  "customerTrns": "Short description of items/services purchased to display to your customer",
  "requestLang": "en-GB"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic [Base64-encoded Merchant ID and API key]'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;