Introduction

The reference is your key to a comprehensive understanding of the Notion API.

<aside> ❗ As a solution provider you might find yourself in need of a service that allows you to provide loans to your customers. MIM’s embedded lending service allows you to do this quick and easy with a little bit of HTML, CSS and a little bit more of Javascript.

</aside>

Requirements

  1. Completed aggregator form - https://embed.moneyinminutes.ng/
  2. Your account public and secret key
  3. A little knowledge of HTML, CSS & JavaScript

Sign Up with MIM

The first thing is to click on the link to complete the onboarding form where you are required to supply the information below and submit. A member of our team will verify your submission and confirm approval via email. You will receive another email containing your public and secret key.

| Info | Description | | --- | --- | | Name | Company name | | RC Number | Company rc number | | Email | Company email | | Phone number | Company contact phone number | | Description | About the company | | Website | Company website | | Address | Company address | | TIN | Company tax identification number | | Industry | Company industry | | Company Size | Size of the users expected to take loans | | Consistent Payday | Date for loan repayments | | Highest Staff/Customer Income | Maximum income of user the company will offer loan to | | Lowest Staff/Customer Income | Minimum income of user the company will offer loan to | | Terms and Condition URL | Url where the user can see the company terms and conditions | | Loan Application Redirect URL | Webhook Url for MIM to call to pass the users loan status at the point of submission | | Loan Status URL | Webhook Url for MIM to call to pass the users loan status at any point after submission | | Customer History URL | Url to provide us with the users financial transaction history on your platform | | Product URL | The URL that your customers will use in accessing a loan on your platform |

Now that we have a key and a secret, what next?

In order to gain access to MIM’s library for embedded lending, you simply have to link the library as shown below:

content.png

This gives you access to the loadMimEmbedded() function. This function takes to parameters which are:

  1. The ID of the button that triggers the beginning of a loan application process.
  2. A JSON object containing the information required to take a loan.

The JSON object needs to conform to the structure below:

{

email: "[email protected]",

phoneNumber: "08093773683",

bvn: "09578490230",

nin: "09578490232",

apiKey: "{{ *Your API key goes here* }}",

authorisation: "{{ *Your Authorisation goes here* }}",

requestKey: "{{ *Your Request Key goes here* }}",

loanId: "{{ *Your  Loan ID goes here* }}",

bankCode: "200",

customerId: "{{ Your application's unique ID for the customer }}",

bankAccountNumber: "0987654321",

employmentRecord:

{

sector: EmployerSector.Banking,

employmentType: EmploymentType.Employed,

employerName: "MIM Finance Ltd",

employerAddress: "Lekki Phase 1, Lekki",

city: "Lagos",

state: "Lagos",

employerPhone: "08093773683",

employmentDate: '2020-03-07T00:00:00',

netMonthlyIncome: 150000.00,

duration: EmploymentLength.Four,

nextPayDay: '2023-06-30T00:00:00',

toleranceDays: 2,

totalMonthlyExpense: 100000,

salaryFrequency: PayFrequency.Monthly,

incomeReceiptMode: IncomeReceiptMode.Bank

}

}

Clearing possible sources of confusion

There are a few parameters in the JSON object that may not be intuitive

Parameter Description
requestKey This is a Guid generated for every request. It is used to calculate the value of the Authorisation parameter.
authorisation This is generated by computing the Sha512 of the concatenation of the strings; apiKey, requestKey and apiSecret (In this order).
loanId This is the key to be used as the primary key for accessing information about the loan on your database, it also allows MIM send information pertaining to your loan directly to your server.
employmentDate and nextPayDay The datetime parameters are required to conform to this format: YYYY-MM-DD

There are objects that make it easy provide values to some of the parameters.

employerSector:

{

Public: 1,

Private: 2,

Banking: 3,

OilAndGas: 4,

FMCG: 5,

Construction: 6,

Manufacturing: 7,

Other: 8

};

employmentType:

{

Employed: 1,

SelfEmployed: 2,

Contract: 3,

PartTime: 4,

Unemployed: 5

};

employmentLength:

{

LessThanOne: 0,

One: 1,

Two: 2,

Three: 3,

Four: 4,

Five: 5,

Six: 6,

Seven: 7,

Eight: 8,

Nine: 9,

Ten: 10,

TenPlus: 11

};

payFrequency:

{

Weekly: 2,

Monthly: 3

};

incomeReceiptMode:

{

Bank: 1,

Cheque: 2,

Cash: 3

};

If all goes well, a click on our button should give us something like this:

Untitled

Callbacks

For the loans to be properly serviced and interactions maintained between or systems, a number of callbacks are required to be made available from you. These are in addition to the ones we have made available on our end.

These callbacks are described below:

1. Loan Status Check Callback (MIM)

This is an MIM URL you call whenever you want to verify the status of a loan taken by a user on your system.

The status check is done by making a POST request to the URL below. This check can be done at any time, if you wish to know the status of the loan:

METHOD: POST

PAYLOAD SAMPLE:

curl <https://devembed.azurewebsites.net/embed/webhook/request-loan-status>
  {
    "loanId" : "2561065d-77e3-4c77-a623-6428caa70d51",
    "apiKey" : "{{ Your API Key goes here }}",
    "requestKey" : "{{ Your Request Key goes here }}",
    "authorisation" : "{{ Your Authorisation goes here }}"
}

RESPONSE SAMPLE:

{
    "success": true,
    "message": null,
    "data": "Approved"
}

The data parameter of this JSON object tells us the status of the loan.

Loan Status

We can use this data to make updates on our web app and redirect users as appropriate.

| --- | --- |

2. Loan Repayment Callback URL (MIM)

If you wish to do the loan collection on your system, this is the endpoint you invoke to inform MIM whenever you successfully make any collection on the loan repayment schedule. Invoking of this URL before a collection schedule is due compels MIM system to not attempt to effect a collection for that particular schedule.

PAYLOAD SAMPLE:

curl <https://devembed.azurewebsites.net/embed/webhook/notify-loan-repayment>
  {
    "mimLoanId" : 341,
    "apiKey" : "{{ Your API Key goes here }}",
    "requestKey" : "{{  Your Request Key goes here  }}",
    "authorisation" : "{{ Your Authorisation goes here }}",
    “amount”: 35000,
    “transactionRef”: "{{ Your Transaction Reference }}"
}

RESPONSE: This callback returns HTTP 200 code to indicate that it was successfully registered. No message body.

3. Loan Application Redirect URL