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:
- 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.
- 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.
- 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.
- 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
Key | Description |
---|---|
app-id | Your App ID |
x-api-key | Your Secret Key |
Body
User Statement Check
Key | Description |
---|---|
national_id | National ID number |
M-Pesa Statement Analysis
Key | Description |
---|---|
name | Name of customer |
national_id | National ID number |
location | Location of customer |
gender | Gender of customer |
dob | Date of Birth |
file_base64 | Base64 image of the user's PDF MPESA statement |
M-Pesa Statement Analysis Status
Key | Description |
---|---|
reference_id | Reference ID of Analysis |
M-Pesa Credit Scoring
Key | Description |
---|---|
reference_id | Reference 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)
Response | Description |
---|---|
status | The status of the request. |
response_code | The response code from the server. |
data | The data returned by the server. |
exists | Whether the data exists. |
verification | The verification method used. |
reference | The reference ID for the request. |
session | The session ID for the request. |
Response Description (M-Pesa Statement Analysis)
Response | Description |
---|---|
status | The status of the request. |
response_code | The response code from the server. |
message | A message describing the result of the request. |
data | The data returned by the server. |
reference_id | The ID of the statement that was saved. |
name | The name of the user who owns the statement. |
phone_number | The phone number of the user who owns the statement. |
statement_type | The type of statement that was saved. |
short_code | The short code of the statement. |
statement_period | The period of time covered by the statement. |
session | The session ID for the request. |
Response Description (M-Pesa Statement Analysis Status)
Response | Description |
---|---|
status | The status of the request. |
response_code | The response code from the server. |
data | The data returned by the server. |
status | The status of the statement handling. |
verification | The verification method used. |
reference | The reference ID for the request. |
session | The session ID for the request. |
Response Description (M-Pesa Credit Scoring)
Response | Description |
---|---|
status | The status of the request. |
response_code | The response code from the server. |
message | A message describing the result of the request. |
data | The data returned by the server. |
national_id | The national ID of the customer. |
created_at | The date and time the customer score was created. |
id | The ID of the customer score. |
output_data | An array of data returned. |
national_id | The national ID of the customer. |
first_transaction_date | The date of the first transaction in the statement. |
last_transaction_date | The date of the last transaction in the statement. |
statement_days | The number of days in the statement period. |
inactive_days | The number of days in the statement period where there were no transactions. |
max_sent | The maximum amount sent in a single transaction. |
mean_sent | The average amount sent in a transaction. |
max_received | The maximum amount received in a single transaction. |
mean_received | The average amount received in a transaction. |
total_received_amount | The total amount received in the statement period. |
z_sent | The Z-score for the amount sent. |
z_received | The Z-score for the amount received. |
z_balance | The Z-score for the balance. |
n_received | The number of received transactions. |
n_sent | The number of sent transactions. |
debit_credit_ratio | The ratio of debit transactions to credit transactions. |
no_debit_credit_ratio | The ratio of non-debit transactions to non-credit transactions. |
average_monthly_received | The average monthly amount received. |
avg_balance | The average balance. |
debt_income_ratio | The ratio of debt to income. |
count_of_loan_repayments | The number of loan repayments in the statement period. |
opening_balance | The opening balance in the statement period. |
closing_balance | The closing balance in the statement period. |
count_of_loans | The number of loans taken in the statement period. |
total_borrowed_mpesa | The total amount borrowed from MPESA in the statement period. |
repayment_rate_ratio | The ratio of loan repayments to total loans taken. |
repayment_rate_ratio_n | The ratio of loan repayments to total non-credit transactions. |
repayment_rate | The repayment rate. |
borrowing_vs_income | The borrowing vs income category. |
spending_rate | The spending rate category. |
total_loan_repayment_amount | The total amount repaid for loans taken in the statement period. |
no_of_credit_transactions | The number of credit transactions in the statement period. |
no_of_debit_transactions | The number of debit transactions in the statement period. |
total_spent_amount | The total amount spent in the statement period. |
borrowing_vs_income_ratio | The ratio of total spending to income. |
spending_rate_ratio | The ratio of total spending to total transactions. |
total_savings | The total amount saved in the statement period. |
total_shopping | The total amount spent on shopping in the statement period. |
total_gaming | The total amount spent on gaming in the statement period. |
total_eat_drink | The total amount spent on eating and drinking in the statement period. |
total_betting | The total amount spent on betting in the statement period. |
total_education | The total amount spent on education in the statement period. |
total_technology_electronics | The total amount spent on technology and electronics in the statement period. |
total_groceries | The total amount spent on groceries in the statement period. |
total_fuel | The total amount spent on fuel in the statement period. |
total_airtime_internet_topups | The total amount spent on airtime and internet top-ups in the statement period. |
total_mobile_loans | The total amount borrowed from mobile loans in the statement period. |
total_electricty | The total amount spent on electricity in the statement period. |
total_water | The total amount spent on water in the statement period. |
debt_ratio | The ratio of debt to total spending. |
gender | The gender of the customer. |
dob | The date of birth of the customer. |
name | The name of the customer. |
location | The location of the customer. |
age | The age of the customer. |
unemployment | The unemployment rate in the customer's location. |
inflation | The inflation rate in the customer's location. |
fx | The exchange rate between the local currency and the US dollar. |
gas | The price of gas in the customer's location. |
food_inflation | The food inflation rate in the customer's location. |
bank_rate | The bank lending rate in the customer's location. |
pezesha_mpesa_credit_score | The credit score from PeZesha's MPESA data. |
pezesha_average_score | The average of the PeZesha MPESA credit score and the PeZesha crb credit score. |
pezesha_mpesa_crb_credit_score | The credit score from PeZesha's crb data. |
crb_mobile_loan_score | The credit score from the customer's mobile loan history. |
score | The customer's credit score. |
default_probability | The probability that the customer will default on their debt. |
score_cat | The category of the customer's credit score. |
total | The total amount of transactions in the statement period. |
perc_spending | An array of the percentage of spending on each category. |
total_betting | The percentage of spending on betting. |
total_eat_drink | The percentage of spending on eating and drinking. |
total_gaming | The percentage of spending on gaming. |
total_shopping | The percentage of spending on shopping. |
total_savings | The percentage of spending on savings. |
total_electricty | The percentage of spending on electricity. |
total_mobile_loans | The percentage of spending on mobile loans. |
total_airtime_internet_topups | The percentage of spending on airtime and internet top-ups. |
total_fuel | The percentage of spending on fuel. |
total_groceries | The percentage of spending on groceries. |
total_technology_electronics | The percentage of spending on technology and electronics. |
total_education | The percentage of spending on education. |
total_water | The percentage of spending on water. |
received_amount_trend | An array that shows the trend of the amount received in each day of the statement period. |
2023-07-31 | The amount received on July 31, 2023. |
2023-08-31 | The amount received on August 31, 2023. |
sent_amount_trend | An array that shows the trend of the amount sent in each day of the statement period. |
2023-07-31 | The amount sent on July 31, 2023. |
2023-08-31 | The amount sent on August 31, 2023. |
balance_amount_trend | An array that shows the trend of the balance in each day of the statement period. |
2023-07-31 | The balance on July 31, 2023. |
2023-08-31 | The balance on August 31, 2023. |
verification | The verification method used. |
reference | The reference ID for the request. |
session | The session ID for the request. |
Updated about 1 month ago