Customer Verification

Retrieve customer identity data using their full phone number and understand how to handle subsequent operations.

Overview

The Customer Verification endpoint is a critical first step in payment or transfer workflows. It allows integrators to verify if a user already exists in the system and retrieve their identity details.

This verification is essential to determine how to handle follow-up transactions like Credits (deposits) or Debits (withdrawals).

Endpoint Information

FeatureDetails
MethodGET
URL/external/customer/:fullPhoneNumber
AuthAPI Key & Secret (Headers)

Path Parameters

  • fullPhoneNumber (Required): The complete phone number in international format (e.g., +229XXXXXXXX). This is used as the unique identifier for the customer.

Business Logic & Integration Rules

When using this endpoint, the response (especially a 404 error) dictates how you should proceed with your next API calls:

1. If the Customer is Found (200 OK)

You receive the JSON identity object. You can proceed with both Credit and Debit operations.

2. If the Customer is NOT Found (404 Not Found)

The customer does not yet have a B-MO account. Depending on your intent:

💡 For Credit Operations (Transfer to Customer): You can still proceed with the transaction. However, you must provide the customer's firstname and lastname in the subsequent credit API call. This allows the system to automatically create the B-MO account during the operation so the credit can succeed.

⚠️ For Debit Operations (Withdrawal from Customer): Do not proceed. Any debit attempt on a non-existent customer will inevitably fail since there is no account to pull funds from.


HTTP Status Codes

Status CodeMeaningAction
200 OKCustomer found.Proceed with any operation.
404 Not FoundCustomer does not exist.Follow the "Credit" or "Debit" rules mentioned above.
401 UnauthorizedInvalid API credentials.Check your X-Auth-ApiKey and X-Auth-ApiSecret.

Example Request

import axios from 'axios';

const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';
const phoneNumber = '+22901XXXXXXXX';

axios.get(`https://svc.test.bestcash.me/external/customer/${phoneNumber}`, {
  headers: {
    'X-Auth-ApiKey': apiKey,
    'X-Auth-ApiSecret': apiSecret
  },
})
.then(response => {
  // Customer exists, safe to proceed
  console.log('Customer Details:', response.data);
})
.catch(error => {
  if (error.response && error.response.status === 404) {
    console.warn('Customer not found. Remember: If crediting, provide names for auto-creation.');
  } else {
    console.error('Error:', error.message);
  }
});