# Customers

WARNING

Not all REST API endpoints are available to all users. If you need access to functionality like charge creation, please contact us through the dashboard(opens new window)

# Initiate phone verification

Initiates verification of phone number, which will send a One-Time Password(OTP) to it.

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

{
   "isSuccess": true
}

# Verify phone

Verifies customer's phone number and returns a verification code which is valid for 5 minutes and could be used to initiate a charge.

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

{
   "verificationCode": "1Xbn3jvam8j4Xj10fakfdn1jdnald"
}