To perform a deposit, to a non-agent customer account customer guid of the recipient is required. To retrieve the guid of a SPENN non-agent customer of the same currency us the following API.

Note that the properties IdType and IdNumber (randomly hidden characters) will only be visible if the customer is Verified or James Verified state.

The isTransactionEligable flag shows if the user is able to transact. This can be checked for example prior to doing a deposit, to avoid error responses about users not being fully validated and able to transact.

It’s important to note that this endpoint doesn’t return a guid for agents meaning if the client requests customer information using the agent’s phone number then it will not return customer information rather will send an error message essentially mentioning the customer can’t be found.

Description

Headers

  • Content-Type: The Content-Type header is set to application/json, indicating that the request body contains JSON data.
  • Authorization: The Authorization header is used with a bearer token for authentication. The actual token value should replace the placeholder Bearer eyJhbG...NrEQ41w.

Sample Request:

import requests

def get_customer_data(phone_number, token):
    # URL with the phone number included in the query parameters
    url = f"https://uat-businessapi.spenn.com/api/partner/customer?phoneNumber={phone_number}"

    # Headers with the Authorization token
    headers = {
        'Authorization': f'Bearer {token}'
    }

    # Sending the GET request
    response = requests.get(url, headers=headers)

    # Return the response data (or handle it as needed)
    return response.json()

# Example usage
phone_number = '+255721201119'  # Replace with the actual phone number
token = 'your_bearer_token_here'  # Replace with your actual bearer token
customer_data = get_customer_data(phone_number, token)
print(customer_data)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class CustomerDataFetcher {

    public static void main(String[] args) {
        String phoneNumber = "+255721201119"; // Replace with the actual phone number
        String token = "your_bearer_token_here"; // Replace with your actual bearer token
        String response = getCustomerData(phoneNumber, token);
        System.out.println(response);
    }

    private static String getCustomerData(String phoneNumber, String token) {
        try {
            // URL with the phone number included in the query parameters
            URL url = new URL("https://uat-businessapi.spenn.com/api/partner/customer?phoneNumber=" + phoneNumber);

            // Open a connection
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();

            // Set the request method and headers
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + token);

            // Reading the response
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            connection.disconnect();

            // Return the response content
            return content.toString();

        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

async function getCustomerData(phoneNumber, token) {
    // URL with the phone number included in the query parameters
    const url = `https://uat-businessapi.spenn.com/api/partner/customer?phoneNumber=${phoneNumber}`;

    // Setting up the request headers
    const headers = {
        'Authorization': `Bearer ${token}`
    };

    try {
        // Sending the GET request
        const response = await fetch(url, { headers: headers });

        // Parsing the JSON response
        const data = await response.json();
        return data;
    } catch (error) {
        console.error('Error:', error);
    }
}

// Example usage
const phoneNumber = '+255721201119'; // Replace with the actual phone number
const token = 'your_bearer_token_here'; // Replace with your actual bearer token

getCustomerData(phoneNumber, token)
    .then(data => console.log(data))
    .catch(error => console.error('Error in fetching customer data:', error));

👍

Sample Response

{
    "$id": "1",
    "customerGuid": "02d900ce-aef4-433f-b94a-c56ebab942b8", 
    "isTransactionEligible": false,
    "IdType": "NID",
    "IdNumber": "11**380*02**50*5",
    "PhoneNumber": "+8801675013080",
    "Name": "Sample User Name",
}