Aeropay users are individuals, uniquely identified by a phone number, who can link bank accounts and make transactions. If you are opting for white-labeled user creation in your application, you'll need to create a user before initiating a transaction.

Note that if the user you are creating already has an account with Aeropay, their existing account information will be returned.

Step 1 - Generate a Merchant Token

The POST /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.

HTTP request

Sandbox - POST https://staging-api.aeropay.com/token
Production - POST https://api.aeropay.com/token

Request parameters

ParameterRequired?TypeDescription
api_keyYesStringAPI Key or user email
api_secretYesStringAPI 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
200AP002API credentials are invalidConfirm correct api key, api secret, and environmentInvalid API key or secret key
200AP700Missing request parameterAdd missing parameterMissing required Parameter: 'userId'

Code Example - Request

curl --request POST \
     --url https://staging-api.aeropay.com/token \
     --header 'Content-Type: application/json' \
     --header 'accept: application/json' \
     --data '
{
  "scope": "merchant",
  "api_key": "api-key-ab1341-asdflk3",
  "api_secret": "api-secret-ab1341-asdflk3",
  "id": "1456"
}
'

Code Example - Response

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

Step 2 - Create the User

HTTP request

Sandbox - POST https://staging-api.aeropay.com/user
Production - POST https://api.aeropay.com/user

Request parameters

ParameterRequired?TypeDescription
first_nameYesStringThe User's first name as shown on their government ID
Min xx characters
Max xx characters
last_nameYesStringThe User's last name as shown on their government ID
Min xx characters
Max xx characters
phone_numberYesStringThe User's phone number
Must be in international format (+11234567890)
Landline, VOIP, or prepaid phone numbers are invalid in production.
emailYesStringThe User's email address
Must be a valid email address

Code Example - Request

curl --request POST \
     --url https://staging-api.aeropay.com/user \
     --header 'Content-Type: application/json' \
     --header 'X-API-Version: 1.1' \
     --header 'accept: application/json' \
     --header 'authorizationToken: Bearer {{token}}' \
     --data '
{
  "first_name": "Jane",
  "last_name": "Doe",
  "phone_number": "+11234567890",
  "email": "janedoe@aeropay.com"
}

Code Example - Response

Aeropay will respond with the full user object if the user is new to Aeropay.

{
    "user": {
        "userId": "1234",
        "firstName": "Jane",
        "lastName": "Doe",
        "type": "consumer",
        "email": "janedoe@gmail.com",
        "phone": "+11234567890",
        "token": "None",
        "hasValidated": "None",
        "bankAccounts": [],
        "customerId": "None",
        "username": "84c825e2-01b5-4706-a315-fd8cdafee620",
        "receivesEmail": "0",
        "platform": "None",
        "profImgURL": "None",
        "createdDate": "1605113011"
    }
}

When creating a user, a userId is returned. This userId is the only variable required for referencing the user within the Aeropay system.

If the user already exists in the Aeropay network, this will kick off our network user flow

Error codes

HTTP statusError CodeMeaningResolutionMessage
200N/AMissing phone_number parameterProvide parameter 'phone_number'Phone number required to create an AeroPay user
200N/APhone number is being used by a current Aeropay userHave user provide PIN in email and pass to our /confirmUser endpointYou've previously used AeroPay to pay another business using this phone number. Please verify your identity by entering the pin sent to your email

After a user is created, the user must connect their bank account. For the guide on bank account connection, please see our bank linking guide.