Skip to main content

Repaying a Loan

This guide covers how to repay loans, including full repayment, partial repayment, and repayment using collateral.

Overview

Repayment options:
  • Full Repayment - Pay off the entire loan
  • Partial Repayment - Pay a portion of the loan
  • Repay with Collateral - Use your BTC collateral to repay
  • Collateral Withdrawal - Withdraw excess collateral

Prerequisites

Ensure you have an active loan:
You do not need to call setup() before repayment. repay() prepares the platform wallet address/signature automatically if needed.

Full Repayment

Repay the entire outstanding balance:

Partial Repayment

Pay a portion of the loan:

Repay with Collateral

Use your BTC collateral to repay the loan:

Repay and Withdraw Collateral

Repay and withdraw excess collateral in one transaction:

Checking Repayment Status

Get Repay Transaction Status

Get All Repay Transactions for a Loan

Repayment Workflow Stages

Checking Available Collateral

Before withdrawing, check available collateral:

Collateral-Only Withdrawal

Withdraw collateral without repaying (if health factor allows):

Error Handling

Repay Options Reference

Complete Example

Best Practices

1. Check Balance Before Repaying

2. Calculate Optimal Withdrawal

3. Handle Bridge Delays

The bridge process can take several minutes:

4. Verify Withdrawal Address

Always double-check the BTC address: