Skip to main content
When an offramp transaction’s fiat disbursement fails after Kotani has already received the on-chain crypto, Kotani initiates an automatic refund back to the sender’s address (or to a Lightning invoice for Lightning offramps).

How Refunds Work

  1. On-chain settlement confirmed — Kotani receives the crypto from the sender.
  2. Fiat disbursement fails — Mobile money, bank, or paybill transfer fails or is cancelled.
  3. Refund triggered automatically — Kotani attempts to return the crypto to the integrator.
  4. Webhook firedrefund.completed or refund.failed is sent to your webhook endpoint.
For non-Lightning chains (EVM, Solana, Stellar, Cardano, Tron), Kotani sends the crypto directly back to senderAddress. No action is needed from you. For Lightning, Kotani cannot push funds unprompted — it needs a bolt11 invoice to pay. See below.

Lightning Refunds

Include refund_config when creating the offramp. If fiat fails, Kotani pays the invoice immediately — no manual intervention needed.
Important: Lightning invoices expire. Always provide generate_invoice_url so Kotani can fetch a fresh one if the refund is triggered after the invoice expires. Without it, and with an expired invoice, Kotani falls back to Option B.

Option B — Submit invoice manually when notified

If no refund_config was provided (or bolt11 is expired and no generate_invoice_url exists), Kotani sends a refund.lightning.invoice_needed webhook and an email asking you to submit an invoice via:
The invoice must be for exactly the refund amount in sats, must not be expired, and must not already be paid.

generate_invoice_url Contract

Kotani calls your URL with a POST request when it needs a fresh Lightning invoice:

Request from Kotani

Your expected response

Your endpoint must respond within 10 seconds. If it times out or returns an error, Kotani falls back to the manual notification flow.

Refund Webhooks

refund.completed

Fired when Kotani successfully refunds crypto to the integrator.
The parent transaction’s status is set to REVERSED once refunded.

refund.failed

Fired when refund attempts are exhausted (after up to 5 retries for general errors, 10 for gas/fund errors).
Contact support@kotanipay.com with the referenceId if you receive this — manual intervention will be required.

refund.lightning.invoice_needed

Fired when Kotani needs you to submit a Lightning invoice manually (Option B). Includes the exact amount and the submit URL.

Retry Logic

Use POST /api/v3/offramp/retry-refund/{referenceId} to manually trigger a retry on a FAILED refund.