Skip to main content
The Lending service turns loan events into entries on the Lending module’s accounts. PanoQore holds no loan terms. Schedules, interest calculation, allocation and credit decisions stay in your product, which tells the ledger what happened. A loan is two accounts, known by your loanRef: principal at AST:LON:<CCY>:<ref> and accrued interest at AST:INT:<CCY>:<ref>. What is owed is their balances. loanRef is letters, digits, - and _, up to 40 characters, and carries no personal data.

Before you start

A person must switch on the lending module, which opens the accounts below. Until then, opening a loan gets MODULE_OFF. Your key needs entries:write to record events.

Open a loan

Principal and accrued interest can’t go below zero. Taking more off than is owed is refused, including when repayments race, and including entries posted straight to these accounts. status is OPEN while something is owed and CLEARED when nothing is. CLEARED covers a loan not yet drawn, one repaid, and one written off, so a new loan and a written-off loan read the same. Tell them apart from your own records or the entries. Accounts you opened yourself under those codes count as a loan too.

Record events

Each event is one call to POST /v1/loan-events. With entries:write, it posts at once.
The answer holds either entry, when it posted, or approval, when it waits for a person. The entry’s kind is the event’s with LOAN_ in front, such as LOAN_DISBURSE. stage is 1, 2 or 3. For REPAY, amount comes off principal and interestAmount off accrued interest, as your product allocated it, and a repayment above what is owed gets INVALID_AMOUNT. PROVISION, RELEASE_PROVISION and MOVE_STAGE act on the portfolio, so they take no loanRef.

Write-offs

A write-off always goes to a person, even from a key with entries:write. Everything owed comes off, and amount is what the allowance at stage absorbs. The rest goes to write-offs. reason needs at least 10 characters.
An approver decides it in the console, and the entry then posts as LOAN_WRITE_OFF. If the loan’s balance moved in the meantime, the request ends FAILED and must be proposed again. A key cannot approve its own request, or anyone’s. What a person records through the console for any event also goes to a second person.

Read the book

GET /v1/loan-book takes no parameters and answers with one line per currency.
The allowance is shown as a positive number in minor units.