M-Pesa Statement Analysis

The M-Pesa Statement Analysis API offers a range of functions to make assessing M-Pesa statements easier and smoother. This API includes four main features, each designed for a specific part of statement analysis and financial insight:

  1. Check User Statements: This part serves as a starting point, checking if a person's M-Pesa statement has been reviewed before. This prevents unnecessary repetition, making the analysis process more efficient.
  2. Analyze M-Pesa Statements: Users can use this feature to proactively analyze their M-Pesa statements. The detailed examination digs into the provided statements, extracting important financial information. The results are then shown to the user to verify and authenticate the analysis.
  3. Statement Analysis Status: This function gives real-time updates on the analysis progress. Users can actively track and confirm the status of their previously submitted statement analysis. This transparency keeps users well-informed and confident in the ongoing analysis process.
  4. M-Pesa Credit Scoring: This tailored feature retrieves credit scoring information from a previous analysis. It lets users directly access their credit score results. By providing the credit score from a past analysis, this feature becomes a valuable tool for making informed decisions based on financial status and creditworthiness.

👍

TEST DATA

User Statement Check

national_id: 12345678

M-Pesa Statement Analysis

name: john doe

national_id: 12345678

location: Kenya

gender: Male

dob: 1990-01-01

file_base64:

iVBORw0KGgoAAAANSUhEUgAABLAAAAaiCAIAAAC9wpYhAAAJJWlDQ1BpY2MAAEjHlZVnUJNZF8fv8zzphUASQodQQ5EqJYCUEFoo0quoQOidUEVsiLgCK4qINEWQRQEXXJUia0UUC4uCAhZ0gywCyrpxFVFBeUHfGZ33nf2w/5l7z2/+c+bec8/5cAEgiINlwct7YlK6wNvJjhkYFMwE3ymMn5bC8fR0A/+odyMAWon3dMG/FyEiMo2/HBeXVy4/RZAOAJS9zJpZ6SkrfHSZ6eHxX/jsCguWC1zmGysc/ZXHvuR8ZdGXHF9v7vKrUADgSNHfcfh3/N97V6TCEaTHRkVmM32So9KzwgSRzLSVTvC4XKanIDkqNiHyu4L/VfI/KD0yO30lcpNTNglio2PSmf93qJGBoSH4Nos3Xl96DDH6/3c+K/rmJdcDwJ4DANn3zQuvBKBzFwDSj755ast9peQD0HGHnyHI/OqhVjY0IAAKoAMZoAhUgSbQBUbADFgCW+AAXIAH8AVBYAPggxiQCAQgC+SCHaAAFIF94CCoArWgATSBVnAadILz4Aq4Dm6Du2AYPAZCMAleAhF4BxYgCMJCZIgGyUBKkDqkAxlBbMgacoDcIG8oCAqFoqEkKAPKhXZCRVApVAXVQU3QL9A5

M-Pesa Statement Analysis Status

reference_id: 123458d-f3fb-4aac-a390-00000500001

M-Pesa Credit Scoring

reference_id: 123458d-f3fb-4aac-a390-00000500001

📘

POST

User Statement Check: {{URL}}/identitypass/verification/ke/mpesa/user_check

M-Pesa Statement Analysis: {{URL}}/identitypass/verification/ke/mpesa/statement_analysis

M-Pesa Statement Analysis Status: {{URL}}/identitypass/verification/ke/mpesa/analysis_status

M-Pesa Credit Scoring: {{URL}}/identitypass/verification/ke/mpesa/credit_scoring

Header

KeyDescription
app-idYour App ID
x-api-keyYour Secret Key

Body

User Statement Check

KeyDescription
national_idNational ID number

M-Pesa Statement Analysis

KeyDescription
nameName of customer
national_idNational ID number
locationLocation of customer
genderGender of customer
dobDate of Birth
file_base64Base64 image of the user's PDF MPESA statement

M-Pesa Statement Analysis Status

KeyDescription
reference_idReference ID of Analysis

M-Pesa Credit Scoring

KeyDescription
reference_idReference ID of Analysis

"User Statement Check" Response

{
    "status": true,
    "response_code": "00",
    "data": {
        "exists": true
    },
    "verification": {
        "reference": "d07877d1-0af2-4634-b4c0-fe140d8d4932"
    },
    "session": {}
}

"M-Pesa Statement Analysis" Response

{
    "status": true,
    "response_code": "00",
    "message": "Statement saved successfully. Extraction process initiated",
    "data": {
        "reference_id": "00000000-1111-2222-3333-7cc48a286666",
        "name": "",
        "phone_number": "",
        "statement_type": "user_statement",
        "short_code": null,
        "statement_period": ""
    },
    "session": {}
}

"M-Pesa Statement Analysis Status" Response

{
    "status": true,
    "response_code": "00",
    "message": "Statement handling complete",
    "data": {
        "status": true
    },
    "verification": {
        "reference": "5ea6afdf-860a-4ac2-bb62-31aeda7d4641"
    },
    "session": {}
}

"M-Pesa Credit Scoring" Response

{
    "status": true,
    "response_code": "00",
    "message": "Customer Score result fetched successfully",
    "data": {
        "national_id": "12345678",
        "created_at": "2023-08-17T20:23:59+00:00",
        "id": 12345,
        "output_data": {
            "national_id": "12345678",
            "first_transaction_date": "2023-07-12",
            "last_transaction_date": "2023-08-17",
            "statement_days": 37,
            "inactive_days": 1,
            "max_sent": 14000,
            "mean_sent": 356.16037735849056,
            "max_received": 4000,
            "mean_received": 84.19137466307278,
            "total_received_amount": 31235,
            "z_sent": 0.25990292100267054,
            "z_received": 0.24660813344576477,
            "z_balance": 0.7125369678019545,
            "n_received": 146,
            "n_sent": 225,
            "debit_credit_ratio": 1,
            "no_debit_credit_ratio": 1.54,
            "average_monthly_received": 844,
            "avg_balance": 2973.7808625336925,
            "debt_income_ratio": 0,
            "count_of_loan_repayments": 0,
            "opening_balance": 5.89,
            "closing_balance": 3176.55,
            "count_of_loans": 0,
            "total_borrowed_mpesa": 0,
            "repayment_rate_ratio": 0,
            "repayment_rate_ratio_n": 0,
            "repayment_rate": "Good",
            "borrowing_vs_income": "Bad",
            "spending_rate": "Moderate",
            "total_loan_repayment_amount": 0,
            "no_of_credit_transactions": 146,
            "no_of_debit_transactions": 225,
            "total_spent_amount": 132135.5,
            "borrowing_vs_income_ratio": 0,
            "spending_rate_ratio": 1,
            "total_savings": 0,
            "total_shopping": 0,
            "total_gaming": 0,
            "total_eat_drink": 0,
            "total_betting": 132135.5,
            "total_education": 0,
            "total_technology_electronics": 0,
            "total_groceries": 0,
            "total_fuel": 0,
            "total_airtime_internet_topups": 0,
            "total_mobile_loans": 0,
            "total_electricty": 0,
            "total_water": 0,
            "debt_ratio": 0,
            "gender": "male",
            "dob": "2023-08-17",
            "name": "John Doe",
            "location": "Kenya",
            "age": 0,
            "unemployment": 5.74,
            "inflation": 8,
            "fx": 140,
            "gas": 1.8,
            "food_inflation": 10,
            "bank_rate": 10.5,
            "crb_mobile_loan_score": null,
            "score": 375.7660933879361,
            "default_probability": 0.7396241641241874,
            "score_cat": "Fair",
            "total": null,
            "perc_spending": {
                "total_betting": 100,
                "total_eat_drink": null,
                "total_gaming": null,
                "total_shopping": null,
                "total_savings": null,
                "total_electricty": null,
                "total_mobile_loans": null,
                "total_airtime_internet_topups": null,
                "total_fuel": null,
                "total_groceries": null,
                "total_technology_electronics": null,
                "total_education": null,
                "total_water": null
            },
            "received_amount_trend": {
                "2023-07-31": 14615,
                "2023-08-31": 16620
            },
            "sent_amount_trend": {
                "2023-07-31": 66371.5,
                "2023-08-31": 65764
            },
            "balance_amount_trend": {
                "2023-07-31": 2827.1912,
                "2023-08-31": 3145.2307602339
            }
        }
    },
    "verification": {
        "reference": "12345678-0000-0000-0000-123456789012"
    },
    "session": {}
}
   

Response Description (User Statement Check)

ResponseDescription
statusThe status of the request.
response_codeThe response code from the server.
dataThe data returned by the server.
existsWhether the data exists.
verificationThe verification method used.
referenceThe reference ID for the request.
sessionThe session ID for the request.

Response Description (M-Pesa Statement Analysis)

ResponseDescription
statusThe status of the request.
response_codeThe response code from the server.
messageA message describing the result of the request.
dataThe data returned by the server.
reference_idThe ID of the statement that was saved.
nameThe name of the user who owns the statement.
phone_numberThe phone number of the user who owns the statement.
statement_typeThe type of statement that was saved.
short_codeThe short code of the statement.
statement_periodThe period of time covered by the statement.
sessionThe session ID for the request.

Response Description (M-Pesa Statement Analysis Status)

ResponseDescription
statusThe status of the request.
response_codeThe response code from the server.
dataThe data returned by the server.
statusThe status of the statement handling.
verificationThe verification method used.
referenceThe reference ID for the request.
sessionThe session ID for the request.

Response Description (M-Pesa Credit Scoring)

ResponseDescription
statusThe status of the request.
response_codeThe response code from the server.
messageA message describing the result of the request.
dataThe data returned by the server.
national_idThe national ID of the customer.
created_atThe date and time the customer score was created.
idThe ID of the customer score.
output_dataAn array of data returned.
national_idThe national ID of the customer.
first_transaction_dateThe date of the first transaction in the statement.
last_transaction_dateThe date of the last transaction in the statement.
statement_daysThe number of days in the statement period.
inactive_daysThe number of days in the statement period where there were no transactions.
max_sentThe maximum amount sent in a single transaction.
mean_sentThe average amount sent in a transaction.
max_receivedThe maximum amount received in a single transaction.
mean_receivedThe average amount received in a transaction.
total_received_amountThe total amount received in the statement period.
z_sentThe Z-score for the amount sent.
z_receivedThe Z-score for the amount received.
z_balanceThe Z-score for the balance.
n_receivedThe number of received transactions.
n_sentThe number of sent transactions.
debit_credit_ratioThe ratio of debit transactions to credit transactions.
no_debit_credit_ratioThe ratio of non-debit transactions to non-credit transactions.
average_monthly_receivedThe average monthly amount received.
avg_balanceThe average balance.
debt_income_ratioThe ratio of debt to income.
count_of_loan_repaymentsThe number of loan repayments in the statement period.
opening_balanceThe opening balance in the statement period.
closing_balanceThe closing balance in the statement period.
count_of_loansThe number of loans taken in the statement period.
total_borrowed_mpesaThe total amount borrowed from MPESA in the statement period.
repayment_rate_ratioThe ratio of loan repayments to total loans taken.
repayment_rate_ratio_nThe ratio of loan repayments to total non-credit transactions.
repayment_rateThe repayment rate.
borrowing_vs_incomeThe borrowing vs income category.
spending_rateThe spending rate category.
total_loan_repayment_amountThe total amount repaid for loans taken in the statement period.
no_of_credit_transactionsThe number of credit transactions in the statement period.
no_of_debit_transactionsThe number of debit transactions in the statement period.
total_spent_amountThe total amount spent in the statement period.
borrowing_vs_income_ratioThe ratio of total spending to income.
spending_rate_ratioThe ratio of total spending to total transactions.
total_savingsThe total amount saved in the statement period.
total_shoppingThe total amount spent on shopping in the statement period.
total_gamingThe total amount spent on gaming in the statement period.
total_eat_drinkThe total amount spent on eating and drinking in the statement period.
total_bettingThe total amount spent on betting in the statement period.
total_educationThe total amount spent on education in the statement period.
total_technology_electronicsThe total amount spent on technology and electronics in the statement period.
total_groceriesThe total amount spent on groceries in the statement period.
total_fuelThe total amount spent on fuel in the statement period.
total_airtime_internet_topupsThe total amount spent on airtime and internet top-ups in the statement period.
total_mobile_loansThe total amount borrowed from mobile loans in the statement period.
total_electrictyThe total amount spent on electricity in the statement period.
total_waterThe total amount spent on water in the statement period.
debt_ratioThe ratio of debt to total spending.
genderThe gender of the customer.
dobThe date of birth of the customer.
nameThe name of the customer.
locationThe location of the customer.
ageThe age of the customer.
unemploymentThe unemployment rate in the customer's location.
inflationThe inflation rate in the customer's location.
fxThe exchange rate between the local currency and the US dollar.
gasThe price of gas in the customer's location.
food_inflationThe food inflation rate in the customer's location.
bank_rateThe bank lending rate in the customer's location.
pezesha_mpesa_credit_scoreThe credit score from PeZesha's MPESA data.
pezesha_average_scoreThe average of the PeZesha MPESA credit score and the PeZesha crb credit score.
pezesha_mpesa_crb_credit_scoreThe credit score from PeZesha's crb data.
crb_mobile_loan_scoreThe credit score from the customer's mobile loan history.
scoreThe customer's credit score.
default_probabilityThe probability that the customer will default on their debt.
score_catThe category of the customer's credit score.
totalThe total amount of transactions in the statement period.
perc_spendingAn array of the percentage of spending on each category.
total_bettingThe percentage of spending on betting.
total_eat_drinkThe percentage of spending on eating and drinking.
total_gamingThe percentage of spending on gaming.
total_shoppingThe percentage of spending on shopping.
total_savingsThe percentage of spending on savings.
total_electrictyThe percentage of spending on electricity.
total_mobile_loansThe percentage of spending on mobile loans.
total_airtime_internet_topupsThe percentage of spending on airtime and internet top-ups.
total_fuelThe percentage of spending on fuel.
total_groceriesThe percentage of spending on groceries.
total_technology_electronicsThe percentage of spending on technology and electronics.
total_educationThe percentage of spending on education.
total_waterThe percentage of spending on water.
received_amount_trendAn array that shows the trend of the amount received in each day of the statement period.
2023-07-31The amount received on July 31, 2023.
2023-08-31The amount received on August 31, 2023.
sent_amount_trendAn array that shows the trend of the amount sent in each day of the statement period.
2023-07-31The amount sent on July 31, 2023.
2023-08-31The amount sent on August 31, 2023.
balance_amount_trendAn array that shows the trend of the balance in each day of the statement period.
2023-07-31The balance on July 31, 2023.
2023-08-31The balance on August 31, 2023.
verificationThe verification method used.
referenceThe reference ID for the request.
sessionThe session ID for the request.