> For the complete documentation index, see [llms.txt](https://docs.qiro.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.qiro.fi/developer-section/qiro-instant-settlement/repayments.md).

# Repayments

`repayDrawdown` fully repays one funded drawdown. The partner does not choose a partial repayment amount for this operation.

## Dues preview

```http
GET /v1/drawdowns/{drawdown_id}/dues
```

The dues endpoint is informational. It does not create a repayment, reserve a quote, approve tokens, or transfer funds. Qiro reads fresh contract-backed obligations again when repayment is created.

## High-level SDK

Use `repayDrawdown(...)` for the normal partner flow.

The SDK:

1. retrieves the drawdown and facility;
2. verifies the drawdown is `FUNDED`;
3. verifies the wallet is the facility’s active designated wallet;
4. creates a repayment resource with a generated idempotency key;
5. handles up to two token approval transactions when needed;
6. verifies and sends the repayment transaction;
7. verifies `RepaymentMade` and `DrawdownRepaid` in the receipt;
8. polls the repayment resource until `REPAID` or `FAILED`.

## Immutable operation maximum

When Qiro creates a repayment, it calculates a buffered maximum from current contract dues and stores it on the repayment resource. That maximum is fixed for the lifetime of the resource.

Every approval amount is either `0` for a token reset or exactly the fixed maximum. The repayment calldata also uses the fixed maximum. The contract consumes only what is actually owed according to its accounting.

Qiro refreshes dues before each new preparation. If current dues exceed the fixed maximum before financial calldata has been issued, Qiro fails the repayment with `REPAYMENT_QUOTE_EXPIRED`. The partner should create a fresh repayment.

## Token approval

If allowance is sufficient, creation may return a `REPAYMENT` action immediately.

If allowance is insufficient, creation returns `TOKEN_APPROVAL`. Some tokens require resetting a non-zero allowance to zero before setting a new allowance. The SDK supports this bounded path:

```
TOKEN_APPROVAL amount 0
TOKEN_APPROVAL amount fixed maximum
REPAYMENT amount fixed maximum
```

The SDK stops if the API ever asks for more than two approval transactions.

## Main statuses

```
READY_FOR_SUBMISSION
SUBMITTING
CONFIRMING
REPAID
FAILED
```

Status endpoints remain authoritative if a receipt wait times out or a webhook is missed.
