Authentication

Prior to attempting to query the API you must first complete authentication with the our Platform. The authentication process utilises the account credentials which are supplied following the configuration of your account.

These credentials include the below.

  • TerminalID
  • ClientID
  • ClientSecret

Authentication POST - Request

Authentication is completed via a POST request to the URL shown above. The POST must contain the below data:

Authentication Request
Field NameStateData TypeDescription
grant_typeMandatoryStringAuthorisation type required to confirm the action required.
client_credentialsObtain credentials required to process a transaction.
scopeMandatoryString Confirm scope of the action to be performed with credentials.
pay_by_linkPay by Link API
client_idMandatoryStringProvided to the integrator following the successful creation of a test account.
client_secretMandatoryStringProvided to the integrator following the successful creation of a test account.

Authentication POST - Response

Following the receipt of a correctly formatted authorisation POST the DNA platform will respond with the below.

Field NameData TypeDescription
access_tokenStringAccess token provided by the DNA platform. The token should be securely stored ready to be used in the interactions with the API.
expires_inIntegerNumber of seconds from generation until the access_token expires. If the token is not used before this time has passed a new token will need to be requested.
refresh_tokenStringReserved for future use.
scopeStringList of scopes to which users have agreed to grant access within this access_token
token_typeStringType of token issued
BearerBearer token

Example Request and Response

Example: Authentication Request (NodeJs)
var request = require("request");
var options = {
method: 'POST',
url: 'https://oauth.dnapayments.com/oauth2/token',
formData:
{
"access_token": "D*OAeMXErWmCSWcZYsyJf0cRZlC5C$hCR2dEGJp7.2q1W*z_iSC9sa3JGLtAR3ZG",
"expires_in": 7200,
"refresh_token": "!NnycppKptqQE_w6!0oul!=bCEXlu=JX*7yW!h.xpuHJvs9ums9lPJ1FpUfmSfH7",
"scope": "pay_by_link",
"token_type": "Bearer"
}
};
request(options, function (error, response, body)
{
if (error) throw new Error(error);
console.log(body);
});