# Customers

Some API endpoints are restricted to a limited number of partners. If you require access to functionality like charge creation, please contact us through the dashboard (opens new window).

Before creating a charge, an API client is required to facilitate phone verification, by doing the following steps in order:

# Initiate phone verification

Initiates verification of a customer's phone number by sending an One-Time Password(OTP) to the number.

Endpoint POST /customers/phone/verification

Payload attributes

Parameter Default Description
phone none An object with code & phone attributes

Request example

curl
-H "Content-Type: application/json"
-u {API_KEY}:{API_SECRET}
-X POST
 -d '{"phone": {"code": "+65", "phone": "87767192"}}'
"https://api.xanpay.com/customers/phone/verification"

Response example

{
   "isSuccess": true
}

# Verify phone number

Verifies customer's phone number and returns a verification code which is valid for 5 minutes and could be used to initiate a charge. To do so, it requires the a customer's phone number and a verification code that the customer has entered.

Endpoint POST /customers/phone/verify

Payload attributes

Parameter Default Description
phone none An object with code & phone attributes
code none OTP received from POST /customers/phone/verification

Request example

curl
-H "Content-Type: application/json"
-u {API_KEY}:{API_SECRET}
-X POST
 -d '{"phone": {"code": "+65", "phone": "87767192"}, "code": "123456"}'
"https://api.xanpay.com/customers/phone/verify"

Response example

{
   "verificationCode": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZU51bWJlciI6Iis2NTEyMzQ1Njc4OTAxIiwicGhvbmUiOnsiY29kZSI6Iis2NSIsInBob25lIjoiMTIzNDU2Nzg5MDEifSwiY3VzdG9tZXIiOnRydWUsImp3dGlkIjoiZDVhNDJhMzUtM2I2Ny00MGY0LTg3Y2YtOTgyZTBhNmYyMDkwIiwiaWF0IjoxNjM4MzQxMzMyLCJleHAiOjE2MzgzNDMxMzJ9.BeNOlbOkBOBp99uhFbWEGbVMHxXeqAI7Owv-ed7j990"
}