Skip to main content

LoanRepayment

Repays a funded loan using currency units. The loan must be funded and not already repaid.

Request

POST /nxt?requestType=loanRepayment

Parameters

NameTypeDescriptionRequired
secretPhrasestringBorrower's secret passphraseYes
loanlongLoan ID to repayYes
currencylongCurrency IDYes
unitsQNTlongNumber of units to repayYes
feeRateQNTPerFXTlongTransaction fee rateOptional
deadlineintTransaction deadline in minutesOptional

Constraints

  • The loan must be funded (not already repaid or rescued)
  • The borrower must be the loan account
  • The currency must match the loan's currency
  • The repayment amount must cover principal plus interest

Response

{
"transaction": "1234567890123456789",
"fullHash": "abc123...",
"errorCode": 0,
"errorDescription": ""
}

Error Handling

ErrorCondition
LOAN_REPAIDLoan is already repaid or rescued
INCORRECT_LOANLoan is not eligible for repayment
INCORRECT_CURRENCYCurrency does not match loan
NOT_ENOUGH_CURRENCYInsufficient currency balance

Example

curl -X POST http://localhost:22024/nxt \
-d "requestType=loanRepayment" \
-d "secretPhrase=your_phrase" \
-d "loan=55555" \
-d "currency=987654321" \
-d "unitsQNT=1050000000"