Using MO's Lending Core API
After fully configuring your Loan Product in MO's Admin Portal, you are ready to offer it to your customers, as presented on the Lending Core quickstart page. This page will detail the steps taken after the loan product configuration, starting with the customer creation, creating a loan request, upgrading a previously created pre-loan by creating a loan, and creating payments.
Authentication
MO Technologies APIs require authentication to be used. All endpoints require you to inform the x-api-key in every request's header. To learn more, refer to the Authentication page.
Creating a customer
In MO, every customer will start as a pre-customer. After they meet the business rules to become a customer, for example, completing the onboarding process or accepting the terms and conditions, upgrade them to a customer.
Creating a pre-customer
To create a pre-customer, follow these steps:
- Make an API call to the Create pre-customer endpoint.
- Add the needed information to the request payload. The available fields of the payload are:
Field | Description | Required | Example |
---|---|---|---|
external_id | External identifier for the pre-customer. | No | YOUR_EXTERNAL_SYSTEM_ID |
first_name | First name of the pre-customer. | Yes | John |
last_name | Last name of the pre-customer. | Yes | Doe |
document_type | Type of document. | No | Passport |
document_number | Document number. | No | C03004783 |
phone | Phone number of the pre-customer. | No | +1 555-123-4567 |
email | Email address of the pre-customer. | Yes | [email protected] |
address | Address of the pre-customer. | No | 123 Main St, Cityville, State, 12345 |
- Send the request.
In the JSON response, you will receive the unique identifier of the created pre-customer. You can find it by accessing the data.id
property.
Upgrading to customer
After the customer above completes the onboarding process, accepting the terms and conditions, they are ready to be upgraded to customer. To do so, follow these steps:
- Make an API call to the Create customer endpoint.
- Add the needed information to the request payload, sending the
precustomer_id
. The available fields of the payload are:
Field | Description | Required | Example |
---|---|---|---|
precustomer_id | Identifier for the pre-existing customer. | Yes | 3fa85f64-5717-4562-b3fc-2c963f66afa6 |
external_id | External identifier for the customer. | No | YOUR_EXTERNAL_SYSTEM_ID |
first_name | First name of the customer. | Yes | John |
last_name | Last name of the customer. | Yes | Doe |
document_type | Type of document. | No | Passport |
document_number | Document number. | No | C03004783 |
phone | Phone number of the customer. | No | +1 555-123-4567 |
email | Email address of the customer. | Yes | [email protected] |
address | Address of the customer. | No | 123 Main St, Cityville, State, 12345 |
personal_accepted_at | Timestamp when personal agreement was accepted. | No | 2023-01-15T12:30:00Z |
commercial_accepted_at | Timestamp when commercial agreement was accepted. | No | 2023-01-15T13:00:00Z |
- Send the request.
The response JSON, similarly to the previous request, will return you the unique identifier of the created customer, which can be found inside the data.id
property.
As the customer is ready and created, they can apply for a credit loan.
Creating a loan request
In MO, when your customer requests a loan, you need to start by creating a loan request, which can also be defined as a pre-loan. This entity represents the initial stage of the loan process before final approval and disbursement.
To create a new loan request, do the following:
- Make an API call to the Create loan request endpoint.
- Add the needed information to the request payload. The available fields of the payload are:
Field | Description | Required | Example |
---|---|---|---|
amount | Total loan amount. | Yes | 1000.00 |
number_of_installments | Number of installments for the loan. | Yes | 12 |
downpayment_amount | Initial payment amount. | No | 200.00 |
customer_id | Identifier for the customer. | Yes | 3fa85f64-5717-4562-b3fc-2c963f66afa6 |
offer_id | Identifier for the loan offer. | Yes | 5e8bbdc5-6c46-4c80-a43d-66fb8a410105 |
external_id | The external identifier for the loan. | No | YOUR_EXTERNAL_SYSTEM_ID |
taken_at | Timestamp when the loan was taken. | Yes | 2023-12-27 |
- Send the request.
The JSON response will present you with the pre-loan's unique identifier found in the data.id
property.
Creating a loan
When a loan is approved and disbursed, it is time to create a loan, upgrading a previously created pre-loan. In MO, to do this upgrade, you need to do the following steps:
- Make an API call to the Create loan endpoint.
- Add the needed information to the request payload, adding the
pre_loan_id
to it. The available fields of the payload are:
Field | Description | Required | Example |
---|---|---|---|
pre_loan_id | Identifier for the pre-existing loan | Yes | 3fa85f64-5717-4562-b3fc-2c963f66afa6 |
aggregator_id | Identifier for the aggregator | Yes | 5e8bbdc5-6c46-4c80-a43d-66fb8a410105 |
external_id | The external identifier for the loan | No | a7b8c9d0-e1f2-4b3c-8d9a-0e1f2a3b4c5d |
disbursed_at | Timestamp when the loan was disbursed | No | 2023-12-27 |
- Send the request.
The JSON response will present you with the loan's unique identifier found in the data.id
property.
Creating payments
It's essential to record your customer's loan payments in MO so that the system can accurately track loan repayment progress. This process is done by informing the details of each payment, by following these steps:
- Make an API call to the Create payment endpoint.
- Add the required information to the request payload. The available fields of the payload are:
Field | Description | Required | Example |
---|---|---|---|
customer_id | Identifier for the customer | Yes | 3fa85f64-5717-4562-b3fc-2c963f66afa6 |
loan_id | Identifier for the loan | Yes | 5e8bbdc5-6c46-4c80-a43d-66fb8a410105 |
amount | Loan amount | Yes | 100.00 |
external_id | The external identifier for the loan | No | YOUR_EXTERNAL_SYSTEM_ID |
application_mode | Mode of loan application | Yes | installment |
- Send the request.
The response JSON will present you with details about every payment from the respective loan, including this one. Below is an example of the returned JSON:
{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"loan_payments": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"amount": 100,
"loan": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"reference": "string",
"external_id": "string"
}
},
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"amount": 100,
"loan": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"reference": "string",
"external_id": "string"
}
}
]
},
"metadata": {
"timestamp": "2023-08-30T16:30:00Z",
"version": "2"
},
"errors": []
}
Updated about 1 month ago