Payment+ » Documentations » Activation

Create Api Key

Before start using the REST Api, you have to create an API Key, from the Api Key section under settings.

Keep your secret key in a safe place, the key will not be saved in our database, so you can't retreive it after creation

Obtain an access token

In order to call the API, you have to obtain an access token first.

Go and create a new Api Key if you didn't yet

To obtain an access token, you have to call the following endpoint
https://store.treasuryxpress.com/connect/token
using the form encoding, by passing your client_id and client_secret parameters, grant_type should always be client_credentials

grant_type should always be client_credentials

You must use form-urlencoded content-type:
Content-Type: application/x-www-form-urlencoded; charset=utf-8

POST /connect/token HTTP/1.1
Host: store.treasuryxpress.com
Content-Type: application/x-www-form-urlencoded; charset=utf-8

client_id=CLIENT_ID_HERE
    &client_secret=CLIENT_ID_SECRET
    &grant_type=client_credentials            
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \  
-d 'client_id=CLIENT_ID_HERE' \
-d 'client_secret=CLIENT_SECRET_HERE' \
-d 'grant_type=client_credentials' \ 
"https://store.treasuryxpress.com/connect/token"
const unirest = require('unirest'), 
    url = 'https://store.treasuryxpress.com/connect/token',
    req = unirest('POST', url);

req.headers({
    'content-type': 'application/x-www-form-urlencoded'
})

.form({
    client_id: "CLIENT_ID_HERE",
    client_secret: "CLIENT_SECRET_HERE",
    grant_type: "client_credentials"
})

.end(function (res) {
    if (res.error) throw new Error(res.error);
    var authHeader = 'Bearer ' + res.access_token;
});
{
    "access_token": "CfDJ8OpcEOrPwjdIkq75JPHAl-oPooo9WypOB3neq62_3...", 
    "expires_in": 7200, 
    "resource": "resource_server", 
    "token_type": "Bearer"
}