Credit assessments give you a real time credit rating and credit score for a borrower registered on your lending application. This guide aims to demonstrate how to do a deep integration to the Weza.io Lending APIs on your application so that you can start using credit assessments.
Prerequisites
To use the Lending APIs, you will require the following.
You can setup your organization, project, API credentials and lending app (and much more) using our web dashboard at dashboard.weza.io. You can reach out to the weza technical team on our developer slack if you encounter any problems.
A valid weza.io project with billing enabled and the Lending API activated.
Valid weza.io API client credentials. See the authentication section on how to perform authenticate and authorize requests on weza.io. The authorizing user should have the Lending App Admin role.
A valid weza.io Lending App.
One or more users who are requesting for loans (borrowers) from an Android device.
SMS texts and phone contacts for each user. SMS texts have to be from within the last 6 months.
A server that can communicate with weza.io APIs. If your lending application is hosted on a server, then this is enough.
Send Requests
For our use case, let us assume we want to get an instant personal credit assessment whenever someone requests for a loan on our lending app.
We will need to perform the following actions using the Lending APIs.
Create borrower account.
Update borrower account.
Create borrower events.
Create and retrieve borrower assessment
Let's look at each in detail.
Create Borrower Account
A borrower is an individual or company account that can apply and receive loans on a lending app.
When a borrower creates an account on your app, you will need to register them on the platform using the apps.borrowers.create API method.
Whenever any device or loan or settings information is updated for a borrower, you will need to send the updated list of devices and loans and/or settings using the apps.borrowers.patch method.
Whenever you receive lending data from the user, you will need to send it to weza.io by creating a personal_data.received event using the apps.events.create API method. All PII is encrypted before we save it to our servers.
Keep in mind to send data that is only less than 5MB in size.
Make sure reporting of user data happens regularly for each borrower or you will not get successful assessments. Most assessments will need data from the past 6 months of the assessment timestamp.
{"accountId":"borrower:10023","eventType":"personal_data.captured","timestamp":"2020-03-11T12:00:00+03:00","data": [ {"kind":"lending.wezaapis.com/contact","values": [ {"name":"William DuBois","primaryAddress":{"addressName":"+254 722034142","addressType":"telephone"},"otherAddresses": [ { "addressName":"+(254)733-034-142","addressType":"telephone"}, { "addressName":"william.dubois@gmail.com","addressType":"email"} ] } ] }, {"kind":"lending.wezaapis.com/sms","values": [ {"address":"MPESA","direction":"inbound","timestamp":1576222666000, "rawBody": "NLD3MRV89V Confirmed. On 13/12/19 at 10:37 AM Give Ksh8,000.00 cash to Technology House Ltd Village Market New M-PESA balance is Ksh12,136.06.",
"read":1 }, {"address":"MPESA","direction":"inbound","timestamp":1473413040000, "rawBody": "KI94NZ5MGI confirmed.You bought Ksh10.00 of airtime on 9/9/16 at 12:24 PM.New M-PESA balance is Ksh152.00.",
"read":1 }, {"address":"+254729194910","direction":"outbound","timestamp":1574620767564,"rawBody":"please call me","read":1 }, {"address":"+254733456091","direction":"inbound","timestamp":1579891167564,"rawBody":"Check email","read":1 }, {"address":"+254722034142","direction":"inbound","timestamp":1580495967564,"rawBody":"Thanks!","read":1 } ] } ]}
Create and Retrieve Assessment
When a borrower requests for a loan on your app, you will create a credit assessment for them using the apps.assessments.create API method.In this example, we will use the default credit assessment type for individual accounts, i.e assessmentTypes/personal_credit_standard.
In most cases, an assessment type is restricted to only certain subset of lending apps and/or lending accounts. See the assessmentTypes API reference for more information. The assessmentTypes.list API method also has a listing of all available types of lending assessments.
The API is asynchronous and as such you will need to store the assessmentId returned in the response and then poll for the result by fetching this resource using the apps.assessments.get API method described below. In ordinary circumstances, the assessment will be processed within 90 seconds.
Weza.io will return a result that will advise you on the credit and risk level for the borrower.
If you decide to give out a loan based on this assessment, make sure to store the assessmentId returned in this response on your back end data store alongside your actual loan record and send that information when updating the borrower account so that we can determine whether the assessment was helpful to you.
See the LoanSummary type reference for information on that.