Refunds - Relay

What is a refund?

A refund returns funds to a user when a swap or bridge cannot be completed. Refunds are paid on the origin chain to the refundTo address supplied on the quote. If refundTo is not set, automatic refund is disabled.

What causes refunds to happen?

A refund is triggered when the swap or bridge fails to complete. A failure can occur for a variety of reasons including but not exclusive to:

Refund amounts and costs

The refund amount may be less than what you originally deposited due to several factors:

For example, if you send us a memecoin it will be swapped to USDC as a part of the deposit transaction. In the case of a refund we will refund in USDC for the amount the deposit contract received after the swap into USDC minus the cost of gas.

When is there no refund given?

If the refund amount is not enough to cover the cost of gas, Relay will mark the bridge or swap as failed & no refund will be sent.

What currency is used for refunds?

The refund currency can vary by route. Relay will always attempt to refund the user in the original currency they sent. Usually this is one of the currencies in the solverCurrencies in the chain api response, which are native or stable coins.

Are refunds automatic & instant?

Yes, refunds happen automatically when swaps or bridges fail to complete. If a failure occurs, Relay will refund the user’s funds almost instantly. Please remember no refund is given if the refund amount cannot cover the cost of gas.

How can I force a refund for testing purposes?

You can force a refund by passing debug-force-refund as the referrer.

cURL

curl -X POST \
  'https://api.relay.link/quote/v2' \
  -H 'Content-Type: application/json' \
  -d '{\n    "referrer": "debug-force-refund",\n    "user":"0xf3d63166F0Ca56C3c1A3508FcE03Ff0Cf3Fb691e",\n    "originChainId":8453,\n    "destinationChainId": 10,\n    "originCurrency":"0x0000000000000000000000000000000000000000",\n    "destinationCurrency":"0x0000000000000000000000000000000000000000",\n    "recipient":"0xf3d63166F0Ca56C3c1A3508FcE03Ff0Cf3Fb691e",\n    "tradeType":"EXACT_INPUT",\n    "amount":"1000000000000000000"\n  }'