In this "How-to" guide we will show you how to run the “Hello World” project using Visa Hello World API and and API Key - Shared Secret Authentication. The Hello World API is a simple API for testing the connectivity with the Visa Network.
Important Links:
Before you are able to run the “Hello World” Project, you must create a Visa Developer Portal (VDP) project and get credentials. If you haven't registered yet just click on register here, fill out the account information, agree to the terms and conditions and click on receive emails. Once you have successfully activated your account, you will see your dashboard and you are ready to go.
Once you are there, click on create your first project if this is your first project. On the next page, you will be asked for details, such as project name, description and a list of APIs to choose from.
For this tutorial, we're going to select CyberSource Payments and click create project.
After creating your project, you will be redirected to the project summary page. You can obtain your project credentials by browsing the left side navigation menu of your project and click on “Credentials”.
To be able to make an API call with X-Pay-Token Authentication, you need to have the following:
Next, we'll show you how to run the “Hello World API” with X-Pay-Token on Postman. Postman is a free and open source API development and testing solution, and can be can be downloaded using below link:
KEY: apiKey
VALUE: Please make sure to set your API Key
KEY: x-pay-token
VALUE: {{x-pay-token}}
var resourcePath = 'helloworld';
var queryParams = 'apiKey=<YOUR API KEY>';
var sharedSecret = '<YOUR SHARED SECRET>';
var postBody = '';
var timestamp = Math.floor(Date.now() / 1000);
var preHashString = timestamp + resourcePath + queryParams + postBody;
var hashString = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(preHashString, sharedSecret));
var xPayToken = 'xv2:' + timestamp + ':' + hashString;
postman.setEnvironmentVariable('x-pay-token', xPayToken);
var queryParams = 'apiKey=<YOUR API KEY>';
var sharedSecret = '<YOUR SHARED SECRET>';
Want more? Join the Visa Developer Community to get alerts on the latest tutorials, guides and new developer resources. Stay tuned for more in the series.