Get Customer by Phone Number
This endpoint allows you to get customer identity data by providing his phone number.
Method
- GET
URL
- /customer/:fullPhoneNumber
Input
- fullPhoneNumber (path parameter): The full phone number including the phone code and the phone number. This parameter is required to identify the specific customer.
Output
- Customer Details: A JSON object containing the customer identity details such as
firstname,lastname,phone, and other relevant information.
HTTP Status Codes
- 200 OK: The request was successful, and the customer identity details are returned.
- 404 Not Found: The requested customer does not exist.
Example Request
Here is an example of how to request the identity details of a customer using the fullPhoneNumer:
import axios from 'axios';
const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';
axios.get(`https://svc.test.bestcash.me/external/customer/+22901XXXXXXXX`, {
headers: {
'X-Auth-ApiKey': apiKey,
'X-Auth-ApiSecret': apiSecret
},
})
.then(response => {
console.log('Customer Identity Details:', response.data);
})
.catch(error => {
if (error.response.status === 404) {
console.error('Error: Customer not found.');
} else {
console.error('An error occurred:', error.message);
}
});
Output sample
{
"firstname":"Rob",
"lastname":"Mathews",
"phone":"+2290156545258",
"country": {
"name" : "BENIN"
}
}
Summary
Use this endpoint to check the customer identity data by providing the fullPhoneNumber. Ensure that the fullPhoneNumber is correct to avoid a 404 Not Found error.