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:

  1. Make an API call to the Create pre-customer endpoint.
  2. Add the needed information to the request payload. The available fields of the payload are:
FieldDescriptionRequiredExample
external_idExternal identifier for the pre-customer.NoYOUR_EXTERNAL_SYSTEM_ID
first_nameFirst name of the pre-customer.YesJohn
last_nameLast name of the pre-customer.YesDoe
document_typeType of document.NoPassport
document_numberDocument number.NoC03004783
phonePhone number of the pre-customer.No+1 555-123-4567
emailEmail address of the pre-customer.Yes[email protected]
addressAddress of the pre-customer.No123 Main St, Cityville, State, 12345
  1. 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:

  1. Make an API call to the Create customer endpoint.
  2. Add the needed information to the request payload, sending the precustomer_id. The available fields of the payload are:
FieldDescriptionRequiredExample
precustomer_idIdentifier for the pre-existing customer.Yes3fa85f64-5717-4562-b3fc-2c963f66afa6
external_idExternal identifier for the customer.NoYOUR_EXTERNAL_SYSTEM_ID
first_nameFirst name of the customer.YesJohn
last_nameLast name of the customer.YesDoe
document_typeType of document.NoPassport
document_numberDocument number.NoC03004783
phonePhone number of the customer.No+1 555-123-4567
emailEmail address of the customer.Yes[email protected]
addressAddress of the customer.No123 Main St, Cityville, State, 12345
personal_accepted_atTimestamp when personal agreement was accepted.No2023-01-15T12:30:00Z
commercial_accepted_atTimestamp when commercial agreement was accepted.No2023-01-15T13:00:00Z
  1. 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:

  1. Make an API call to the Create loan request endpoint.
  2. Add the needed information to the request payload. The available fields of the payload are:
FieldDescriptionRequiredExample
amountTotal loan amount.Yes1000.00
number_of_installmentsNumber of installments for the loan.Yes12
downpayment_amountInitial payment amount.No200.00
customer_idIdentifier for the customer.Yes3fa85f64-5717-4562-b3fc-2c963f66afa6
offer_idIdentifier for the loan offer.Yes5e8bbdc5-6c46-4c80-a43d-66fb8a410105
external_idThe external identifier for the loan.NoYOUR_EXTERNAL_SYSTEM_ID
taken_atTimestamp when the loan was taken.Yes2023-12-27
  1. 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:

  1. Make an API call to the Create loan endpoint.
  2. Add the needed information to the request payload, adding the pre_loan_id to it. The available fields of the payload are:
FieldDescriptionRequiredExample
pre_loan_idIdentifier for the pre-existing loanYes3fa85f64-5717-4562-b3fc-2c963f66afa6
aggregator_idIdentifier for the aggregatorYes5e8bbdc5-6c46-4c80-a43d-66fb8a410105
external_idThe external identifier for the loanNoa7b8c9d0-e1f2-4b3c-8d9a-0e1f2a3b4c5d
disbursed_atTimestamp when the loan was disbursedNo2023-12-27
  1. 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:

  1. Make an API call to the Create payment endpoint.
  2. Add the required information to the request payload. The available fields of the payload are:
FieldDescriptionRequiredExample
customer_idIdentifier for the customerYes3fa85f64-5717-4562-b3fc-2c963f66afa6
loan_idIdentifier for the loanYes5e8bbdc5-6c46-4c80-a43d-66fb8a410105
amountLoan amountYes100.00
external_idThe external identifier for the loanNoYOUR_EXTERNAL_SYSTEM_ID
application_modeMode of loan applicationYesinstallment
  1. 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": []
}