API Reference

Repayment API

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

The current status of each EMI can be obtained from this API:

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

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

{
	"is_success": true,
	"data": {
		"status": "<status of the line>",
		"repayments": [{
			"due_date": "<due date of repayment>",
			"status": "<status of emi>",
			"repayment_amount": "<repayment amount>",
			"principal_amount": "<principal amount>",
			"interest_amount's": "<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 are run before recording payments.

POST /api/v1/client/line/<lead_id>/repayment/
{
	"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,
	"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>"
	}]
}

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.
    *EMI payment date should not be before the loan agreement date.

Repayments - Tranche Level

Sometimes, there might be a need for a large number of tranche creations for a given credit line, and over a period of time, this can lead to a large object of redundant data during repayments.

Thus, you can also pass the tranche ID in the URL, to get repayment details only for a given tranche of a lead.

GET /api/v1/client/line/<lead_id>/repayment/<tranche_id>/

Sample response - this would return all repayments and their current state for the given line and tranche.

{
	"is_success": true,
	"data": {
		"status": "<status of the line>",
		"repayments": [{
			"due_date": "<due date of repayment>",
			"status": "<status of emi>",
			"repayment_amount": "<repayment amount>",
			"principal_amount": "<principal amount>",
			"interest_amount's": "<interest amount>",
			"remaining_principal": "<remaining principal amount>",
			"remaining_interest": "<remaining interest amount>",
			"uuid": "<uuid of the EMI>"
		}]
	}
}
POST /api/v1/client/line/<lead_id>/repayment/<tranche_id>/

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

📘

Checks for Repayment Marking

  • Total allocation amount is equal to the sum of the breakdown of all the allocations.

  • Only Rebate allocation can be negative, no other allocation can be negative.

  • The same repayment ID from Razorpay, CashFree, or NACH, etc cannot be allocated to two different tranches.

  • Appropriate repayment due date or UUID must be passed in case of more than 1 EMIs.

  • Remaining principal, Remaining interest, and Remaining amount must not go negative after allocation.

  • EMI payment date should not be before the loan agreement date.

Language
Credentials
Basic
base64
:
URL
Click Try It! to start a request and see the response here!