Authentication Using Identity API

Ezypay API's uses the OAuth 2.0 protocol to authenticate and to authorise external API calls.
Click here on the summary of restful API calls and Oauth 2 authentication that we use at Ezypay.

๐Ÿ“˜

NOTE

A refresh token is required every hour. It is recommended that the token is refreshed within the hour (E.g. refresh token at 55 minutes)

Examples on Using Identity API

When getting an access token, you will need to set the scope to:
"integrator billing_profile"
"create_payment_method"
"offline_access"
The changes required are summarised in the table below:

EndpointAccess ForRequest Params
identity.ezypay.com/tokenAll Ezypay APIs
except
Hosted Page APIs
grant_type=password
client_id=abc
client_secret=xyz
username=myuser
password=mypass
scope=integrator billing_profile create_payment_method offline_access

Below is an example of making an API call:

  • To obtain an access token:
https://identity.ezypay.com/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'cache-control: no-cache' \
  -d 'grant_type=password&client_id=abc&client_secret=xyz&username=myuser&password=mypassscope=integrator%20billing_profile%20create_payment_method%20offline_access'
  • An example response:
{
  "access_token": "ez123-example-tk.",
  "refresh_token": "ez789-example-rfsh",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "integrator billing_profile create_payment_method offline_access"
}

Then use the resulting token to make an API call, e.g. retrieving a customer with id customer-id-123:

https://api-global.ezypay.com/v2/billing/customers/customer-id-123 \
  -H 'Authorization: Bearer ez123-example-tk.' \
  -H 'merchant: Merchant'