Basic auth

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

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

How to authenticate using basic auth

With basic auth, 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.

When you pass your credentials in the header, you must Base64-encode them. The following is an example of an encoded HTTP basic auth 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 \
  https://demo.vivapayments.com/api/orders \
  -H 'Authorization: Basic ZmJmMWUwOTAtNjVkZS00Yzc1LWI1ODAtZDlkOWJjNDk0YWQyOldEdi1WKw==' \
  -H 'Content-Type: application/json' \
  -d '{
  "tags": [
    "Sample string 1",
    "Sample string 2",
    "Sample string 3"
  ],
  "email": "customer@domain.com",
  "phone": "2117604000",
  "fullName": "Customer name",
  "paymentTimeOut": 86400,
  "requestLang": "en-GB",
  "maxInstallments": 12,
  "allowRecurring": true,
  "isPreAuth": true,
  "amount": 100,
  "merchantTrns": "Your reference",
  "customerTrns": "Short description of items/services purchased to display to your customer"
}'

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.

Basic auth and Postman

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

Run in Postman