> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usmewe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Loan Repayment

> How to repay loans and what happens if you don't

# Loan Repayment

Repaying loans on time is crucial for building your Trust Score and maintaining access to the platform.

## Repayment Overview

When you repay a loan, the following happens:

```
┌─────────────────────────────────────────────────────────────────┐
│                     REPAYMENT BREAKDOWN                         │
├─────────────────────────────────────────────────────────────────┤
│  Principal ($50)  →  Returns to Trust Vault                     │
│  Interest ($1.50) →  Distributed to Stakers (tmUSDC holders)   │
│  Your Score       →  +2 points for on-time repayment           │
└─────────────────────────────────────────────────────────────────┘
```

## How to Repay

### Option 1: Manual Repayment

Repay anytime before the due date:

```typescript theme={null}
// Full repayment
await usmewe.loans.repay("loan_xyz789");

// Response
{
  "success": true,
  "loanId": "loan_xyz789",
  "amountPaid": 51.50,
  "principal": 50,
  "interest": 1.50,
  "trustScoreChange": +2,
  "txHash": "0x..."
}
```

### Option 2: Auto-Repayment

Enable automatic repayment from your wallet:

```typescript theme={null}
await usmewe.loans.enableAutoRepay({
  loanId: "loan_xyz789",
  daysBeforeDue: 1 // Repay 1 day before due date
});
```

<Tip>
  Auto-repayment ensures you never miss a payment. Enable it for peace of mind!
</Tip>

### Option 3: Partial Repayment

Pay down your loan in installments:

```typescript theme={null}
await usmewe.loans.repayPartial({
  loanId: "loan_xyz789",
  amount: 25 // Pay $25 of $51.50 total
});

// Remaining balance: $26.50
```

## Repayment Timeline

| Phase            | Duration        | Impact                             |
| ---------------- | --------------- | ---------------------------------- |
| **On-Time**      | Before due date | +2 Trust Score points              |
| **Grace Period** | 1-7 days late   | -5% Trust Score penalty            |
| **Overdue**      | 8-30 days late  | -15% Trust Score + late fees       |
| **Default**      | 30+ days late   | -30% Trust Score + Insurance claim |

## Early Repayment

<Note>
  There are **no penalties** for early repayment! Pay off your loan anytime.
</Note>

Benefits of early repayment:

* Save on interest (prorated)
* Free up borrowing capacity
* Demonstrate reliability

```typescript theme={null}
// Early repayment with interest savings
const savings = await usmewe.loans.calculateEarlyPayoff("loan_xyz789");

// Response
{
  "originalTotal": 51.50,
  "earlyPayoffAmount": 50.75,
  "interestSaved": 0.75,
  "daysEarly": 7
}
```

## Late Payment Consequences

### Grace Period (Days 1-7)

If you miss the due date, you enter a 7-day grace period:

* **No late fees** during grace period
* **Trust Score impact**: -5% of current score
* **Notifications**: Daily reminders sent

### Overdue (Days 8-30)

After the grace period:

* **Late fee**: 1% per week
* **Trust Score impact**: Additional -10%
* **Borrowing**: Disabled until repayment
* **Warnings**: Sent to your Guardians

### Default (Day 31+)

If you fail to repay within 30 days:

```
┌─────────────────────────────────────────────────────────────────┐
│                      DEFAULT PROCESS                            │
├─────────────────────────────────────────────────────────────────┤
│  1. Loan marked as defaulted                                    │
│  2. Insurance Pool covers 80% of principal                      │
│  3. Stakers absorb 20% loss                                     │
│  4. Borrower Trust Score: -30%                                  │
│  5. Borrower banned from new loans for 90 days                  │
└─────────────────────────────────────────────────────────────────┘
```

<Warning>
  Defaulting severely impacts your Trust Score and platform access. Always communicate if you're having trouble repaying.
</Warning>

## Hardship Options

If you're struggling to repay, contact us before defaulting:

<AccordionGroup>
  <Accordion title="Extension Request" icon="calendar-plus">
    Request a 7-14 day extension with valid reason. One extension per loan allowed.

    ```typescript theme={null}
    await usmewe.loans.requestExtension({
      loanId: "loan_xyz789",
      days: 7,
      reason: "Medical emergency"
    });
    ```
  </Accordion>

  <Accordion title="Payment Plan" icon="list-check">
    Split remaining balance into smaller payments over extended period.

    Available for loans over \$100 with Trust Score 50+.
  </Accordion>

  <Accordion title="Guardian Assistance" icon="users">
    Your Guardians can optionally help cover your loan. This is voluntary and improves their Trust Score too.
  </Accordion>
</AccordionGroup>

## Repayment Notifications

Stay informed about your repayment status:

| Event             | Notification                               |
| ----------------- | ------------------------------------------ |
| 7 days before due | "Reminder: Loan due in 7 days"             |
| 1 day before due  | "Reminder: Loan due tomorrow"              |
| Due date          | "Loan due today"                           |
| Grace period      | "Loan overdue - grace period active"       |
| Overdue           | "Urgent: Loan overdue, late fees applying" |

## Trust Score Impact

| Repayment Type  | Trust Score Impact |
| --------------- | ------------------ |
| Early (7+ days) | +3 points          |
| On-time         | +2 points          |
| Grace period    | -5% of score       |
| Overdue         | -15% of score      |
| Default         | -30% of score      |

## API Reference

```bash theme={null}
# Get loan repayment details
curl -X GET "https://api.usmewe.com/v1/loans/{loanId}/repayment" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Response
{
  "loanId": "loan_xyz789",
  "principal": 50,
  "interest": 1.50,
  "totalDue": 51.50,
  "amountPaid": 0,
  "remainingBalance": 51.50,
  "dueDate": "2024-01-29T12:00:00Z",
  "status": "active",
  "daysRemaining": 14
}
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Trust Score" icon="star" href="/core-concepts/trust-score/overview">
    How repayments affect your score
  </Card>

  <Card title="Insurance Pool" icon="umbrella" href="/core-concepts/trust-vault/insurance-pool">
    How defaults are covered
  </Card>
</CardGroup>
