API Reference

Repayment API

Repayment API is used to record each payment, which is done by the customer.

Current status of each EMI can be obtained from this API:

GET /api/v1/client/loan/<lead_id>/repayment/

Sample response, this would return all repayments and their current state for the given loan.

{
    "is_success": true,
    "data": {
        "status": "<status of the loan>",
        "repayments": [
            {
                "due_date": "<due date of repayment>",
                "status": "<status of emi>",
                "repayment_amount": "<repayment amount>",
                "principal_amount": "<principal amount>",
                "interest_amount": "<interest amount>",
                "remaining_principal": "<remaining principal amount>",
                "remaining_interest": "<remaining interest amount>",
                "uuid": "<uuid of the EMI>"
            }
        ]
    }
}

To record the payment, do a POST on this API call. Note that multiple validations run before recording payments.

POST /api/v1/client/loan/<lead_id>/repayment/

Sample Payload:

{
    "amount": "<amount paid by the customer>",
    "payment_mode": "<payment gateway/nach/cash>",
    "payment_date": "<date on which payment was made by the customer.>",
    "payment_id": "<unique identifier of payment>",
    "is_foreclosure": false,
    "is_cancelled":false,
    "is_settled":false,
    "is_closed":false,
    "bureau_date": "<bureau date which is to be used for bureau reporting>",
    "allocation": [
        {
            "due_date": "<repayment due date>",
            "uuid": "<uuid of the EMI>",
            "amount": "<amount going for allocation>",
            "type": "<principal/ interest/late-fee/foreclosure-principal/accrued-interest/foreclosure-fee/foreclosure-tax>"
        }
    ]
}

❗️

System closing at lender's end

The lenders system may close for any given month after 5th or 10th of the next month, depending on the policy. For example, after 31st Oct, the system may close on 5th Nov or 10th Nov of the next month.

Post closing, the system will not accept any payments with payment_date <= system closure date. In such scenario, the API will give an error like below:

{
"is_success":false,
"error": {
"message":"Invalid request data.",
"code":"invalid_request_data",
"details": {
"payment_date": [
"Payment date should not be before 2022-10-31"
]
}
}
}

In such scenario, share payment_date greater than the cutoff date. Also, the bureau_date should be passed as the original payment_date as that is the date which is to be used for bureau reporting.

❗️

A note on payment Id

The payment Ids must be unique and should be coming from your database, the payment ids being passed should not be generated for each request. This will lead to double marking of payments, and cause issues in reconciliation.

In the repayment API, several checks are done before marking, you should ensure that it is done on your side too.

  1. Total allocation amount is equal to the sum of the breakdown of all the allocations.
  2. Only rebate allocation can be negative, no other allocation can be negative.
  3. The same repayment from Razorpay, cash-free or nach cannot be allocated to two different loans.
  4. Appropriate repayment due date or UUID must be passed in case of more than one EMIs.
  5. Remaining principal, Remaining interest, and Remaining amount must not go negative after allocation.
  6. EMI payment date should not be before the loan agreement date.

Charges API.

POST /api/v1/client/loan/<lead_id>/repayment-charges/

Sample request:

{
    "amount": "<amount paid by the customer>",
    "due_date": "<date on which payment has to be made by the customer.>",
    "type": "<NACH Bounce/Late Interest/..>"
}

Sample response:

{
    "is_success": true,
    "data": {
        "charge_id": "<unique charge id>"
    }
}
Language
Credentials
Basic
base64
:
URL
Click Try It! to start a request and see the response here!