Step 1 - Authentication

Authenticate Merchant & Fetch Token

The POST /v2/token endpoint is used to authenticate API integrators for every Aeropay endpoint. The token scope determines who is acting on the system: merchant, user, or userForMerchant (white labeled user). The scope will determine what endpoints are available.

All tokens have a time to live (TTL) of 30 minutes.

Step 1A - Generate the Token

HTTP request

Sandbox - POST https://api.sandbox-pay.aero.inc/v2/token
Production - POST https://api.aeropay.com/v2/token

Request parameters

ParameterRequired?TypeDescription
apiKeyYesStringAPI Key or user email
apiSecretYesStringAPI Secret or user password
scopeYesStringType of token requested
idOnly for merchant & userForMerchant scopeStringMerchant Id
userIdOnly for userForMerchant scopeStringId of user

HTTP status and error codes

HTTP statusError CodeMeaningResolutionMessage
400AP002API credentials are invalidConfirm correct api key, api secret, and environmentInvalid API key or secret key
400AP700Scope is invalidUser either merchant or userForMerchant scopeInvalid scope
400AP700Scope is not providedUser either merchant or userForMerchant scopeMissing required Parameter: 'scope'
400AP700Missing apiSecretMake sure to define a valid string for apiSecretMissing required Parameter: 'apiSecret'
400AP700Missing apiKeyMake sure to define a valid string for apiKeyMissing required Parameter: 'apiKey'
400AP700Missing userIdMake sure to define a valid userId (for userForMerchant token)Missing required Parameter: 'userId'

Code Example - Request

curl --request POST \
     --url https://api.sandbox-pay.aero.inc/v2/token \
     --header 'Content-Type: application/json' \
     --header 'accept: application/json' \
     --data '
{
    "apiKey" : "key",
    "apiSecret" : "secret",
    "scope" : "userFormerchant",
    "id" : 1057,
    "userId": "27bccca2-d345-4620-9987-3f3854abcd51"
}
'

Code Example - Response

{
    "TTL": 1800,
    "token": "eyJ0eXAiOiJKN7YiLCJhbGciOiJIUzI1NiJ9.eyJhdXRoIjoiNDgiLCJzdWIiOiJtZXJjaGFudCIsImp0aSI6ImZhNGY2NzRmLTJkOTEtNGExNS05OTk3LTc1NWI2ZTYyZDhkYiIsImV4cCI6MTY5NDAzNTc2MSwidXNlcm5hbWUiOiJ1cy1lYXN0LTE6M2NlMjBiZDUtNzg03ZCRMjY5LWExM2UtZmM1MzIyMTk0NTAxIn0.3B1sdyVNpTW644RtpoGmQnRlp9PKGjrk91YUi0Uq2Os"
}