Repayments
repayDrawdown fully repays one funded drawdown. The partner does not choose a partial repayment amount for this operation.
Dues preview
GET /v1/drawdowns/{drawdown_id}/duesThe 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:
retrieves the drawdown and facility;
verifies the drawdown is
FUNDED;verifies the wallet is the facility’s active designated wallet;
creates a repayment resource with a generated idempotency key;
handles up to two token approval transactions when needed;
verifies and sends the repayment transaction;
verifies
RepaymentMadeandDrawdownRepaidin the receipt;polls the repayment resource until
REPAIDorFAILED.
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:
The SDK stops if the API ever asks for more than two approval transactions.
Main statuses
Status endpoints remain authoritative if a receipt wait times out or a webhook is missed.