Loan Fractionalisation - P2P Lending
  • 10 Oct 2022
  • 1 Minute To Read
  • Dark
    Light
  • PDF

Loan Fractionalisation - P2P Lending

  • Dark
    Light
  • PDF

Article summary

Please be Aware

API v1 is no longer being actively developed. We strongly recommend that all customers use our API v2 endpoints for all new integrations and transition to API v2 endpoints for existing features wherever possible. For more information, see Using API v1 and API v2.

Description

Starting with Mambu 3.13, a P2P lending functionality was added to allow loan accounts to be funded by investor deposit accounts.

URL

/api/loans
/api/loans/{ID}

Get accounts

The funders information for a loan account can be found in the loan account JSON. Using GET API for Loan Accounts the funders for a loan account can be seen.

Usage example

GET /api/loans/ZNTS744

Sample Response

Sample response isolated with funds from loan account

...
   "funds":[
      {
         "encodedKey":"8a818779565191ba015654a723aa5843",
         "guarantorKey":"8a818779565191ba0156548ce7b15811",
         "guarantorType":"GROUP",
         "savingsAccountKey":"8a818779565191ba0156548d6aaf581e",
         "amount":"4000",
         "type":"INVESTOR"
      },
      {
         "encodedKey":"8a8186f4564c7aa2015654beb82813b4",
         "guarantorKey":"8a8187ce5525555f0155256c9ab40081",
         "guarantorType":"CLIENT",
         "savingsAccountKey":"8a81872a555e47e8015572bf0a5573a0",
         "amount":"1000",
         "type":"INVESTOR"
      }
   ]
...

Creating accounts

New accounts could be created using the Loan Accounts API.

POST /api/loans
{
   "loanAccount":{
      "id":"11255",
      "accountHolderType":"CLIENT",
      "accountHolderKey":"40288a7d4f45f0fd014f45f18b8400ec",
      ...//Other account info
      "funds":[
         {
            "guarantorKey":"GUARANTOR_KEY",
            "savingsAccountKey":"SAVINGS_ACC_KEY",
            "amount":"500"
         }
      ]
   }
}
ParameterValue
guarantorKeyThe encoded key of the client that will invest in the loan
savingsAccountKeyThe client savings account encoded key. It needs to be an active loan of type Funding Account
amountThe amount to be funded by the savings account. The account should have enough balance to cover this amount

Updating loan funds

Funding loans can be done through a POST to /api/loans/{loan_id}/funds API. Any existing investment funds that are not specified in this update call will be deleted and activities will be logged for this change.

POST /api/loans/11255/funds
{
   "funds":[
      {// edit an existing investment fund
         "encodedKey":"40288a5d4f3fbac9014f3fd02745001d",
         "guarantorKey":"40288a5d4f273153014f2731afe40102",
         "savingsAccountKey":"40288a5d4f3fbac9014f3fcf822c0014",
         "amount":"50"
      },
      {// add a new investment fund
         "guarantorKey":"40288a5d4f273153014f2731afe40103",
         "savingsAccountKey":"40288a5d4f3fbac9014f3fcf822c0015",
         "amount":"100"
      }
   ]
}
Please be aware
Permissions required:
Create funds -- Adding new funding source.
Edit funds-- Editing an existing funding source.
Delete funds -- Deleting funding source.

Retrieving the schedule

Get the list of repayments or the list of loans which are founded by a particular account.

Usage examples

Retrieve a list of repayments with the principal due/paid, state, last payment, and other details

GET /api/savings/{SAVINGS_ACCOUNT_ID}/funding/{LOAN_ACCOUNT_ID}/repayments

Get the list of loans which are funded by a particular account

GET /api/savings/{SAVINGS_ACCOUNT_ID}/funding
Please be Aware
The View Fund Details permission is required for this action.

 


Was this article helpful?