How-to for developers · Trading and DeFi

Manage a Loan

In plain words

This guide shows how a loan broker manages a Loan on the XRP Ledger. Managing a loan includes marking it as impaired when a payment is missed, defaulting it after the grace period expires, and deleting repaid or defaulted loans.

Written by zerps in plain words, from the source linked below.
Section
Tutorials

What you will do

You check the status of an existing loan. You impair it by hand to speed up the default process, wait through its grace period and then default it.

What you need

You need a basic understanding of the XRP Ledger and a client library: xrpl.js, xrpl-py or xrpl-go. The feature requires the LendingProtocol amendment, and the LendingProtocolV1_1 amendment updates it. The JavaScript code expects both, the Python and Go code only LendingProtocol.

The steps in short

Read the loan with the ledger_entry method to see the total amount owed and the next payment due date. A loan can only be impaired after a missed payment, so wait until the due date has passed. Send a LoanManage transaction with the tfLoanImpair flag and check for tesSUCCESS. Read the grace period and the updated due date from the result. When the grace period has expired, send LoanManage with the tfLoanDefault flag. Then read the loan's flags to confirm that tfLoanDefault is set.

Good to know

The fixCleanup3_4_0 amendment requires the payment to be late before a loan can be impaired. The Go example sets up a loan with a 60-second payment interval for the guide. The countdowns in the examples show the seconds that remain.

Source: xrpl.org. Read 6 December 2026.

Zerpedia states what the source says, in plain words, and gives no opinion. How Zerpedia is made

zerps Trading tokens on the XRP Ledger carries risk, including total loss. zerps is a self-custodial interface; it does not hold funds, give advice, or execute trades on your behalf.