Errors
Everything the SDK reports is a UniportError. Its code says what happened, and fixableBy says who can do something about it.
UniportError
A UniportError has:
| Field | What it is |
|---|---|
| code | What happened. The codes are listed below. |
| fixableBy | developer, payer or service. |
| message | A sentence that is safe to show the payer. |
| details | More for you: what to change, or the route’s own answer. |
| status | The HTTP status, when the API answered. |
What the payer sees depends on fixableBy:
| fixableBy | Meaning | The payer sees |
|---|---|---|
| developer | Your setup is wrong. | A neutral “payments are not available” message. The reason is in details and in the browser console. |
| payer | The payer can change something. | A sentence saying what, such as the minimum amount. |
| service | Nobody can fix it right now. | A request to try again. |
Checkout.tsx
1<UniportButton2appId="app_..."3recipient="0x..."4destinationToken="arbitrumUSDC"5onError={(error) => {6 if (error.fixableBy === "developer") reportToMyLogs(error.code, error.details);7}}8/>
Your setup, found before any request
The button checks what you pass it before it asks the API for anything. If something is wrong, nothing throws and your page keeps working:
- UniportButton renders disabled.
- UniportModal, used on its own, shows “Payment unavailable”.
- The console says what to change.
- onError is called once.
| code | Cause |
|---|---|
| MISSING_RECIPIENT | recipient is missing or empty. |
| INVALID_RECIPIENT | recipient has spaces around it, or on an EVM chain is not 0x and 40 hex characters. |
| INVALID_DESTINATION_TOKEN | destinationToken is missing or is not a supported token name. |
| INVALID_AMOUNT | amount is set but is not a string holding a positive number, or has more decimals than the token. |
| SECRET_KEY_AS_APP_ID | A secret key was passed as appId. It is never sent. |
| APP_ID_REQUIRED | The site isn’t localhost and no appId was passed. Create an app in the dashboard. |
To run the same check yourself, for example before showing your own button:
check.ts
1import { checkPaymentSetup } from "uniport-sdk";23const problem = checkPaymentSetup({4recipient,5destinationToken,6amount,7appId,8hostname: window.location.hostname, // needed to report APP_ID_REQUIRED9});10if (problem) console.log(problem.code, problem.details);
Your setup, reported by the API
These arrive when the payer asks for a quote. The payer sees the neutral message and the console says what to change.
| code | Cause |
|---|---|
| APP_NOT_FOUND | The App ID is unknown, mistyped or switched off. Copy it again from the dashboard. |
| ORIGIN_NOT_ALLOWED | The App ID is being used on a website that isn’t on its list. Add the site to the app’s allowed websites. |
| RECIPIENT_NOT_ALLOWED | The app only accepts payments to listed addresses, and the recipient isn’t one of them. |
| INVALID_RECIPIENT | The recipient is not a valid address for the destination chain. Chains other than EVM are checked here. |
| RECIPIENT_NOT_READY | The recipient can’t receive the token yet, for example a Stellar account without a trustline. |
The payer’s input
| code | Cause | The payer is told |
|---|---|---|
| INVALID_INPUT | The amount typed is not a number, or has more decimals than the token. | What to enter. |
| NO_LIQUIDITY | There is no route for that pair at that size right now. | To try a smaller amount or another network. |
| AMOUNT_TOO_LOW | The amount is below the route’s minimum. | That it is too small, with the minimum when the route gives one. |
| INVALID_REFUND_ADDRESS | The refund address is not valid for the chain they pay from. | That the refund address is not valid. |
After the payer has sent funds
| code | Cause |
|---|---|
| PAYMENT_REFUNDED | The swap could not complete and the funds were refunded. See Refunds for where they go. |
| PAYMENT_FAILED | The swap failed. |
The service
| code | Cause |
|---|---|
| QUOTE_FAILED | The route refused the quote for a reason not listed above. details has its answer. |
| QUOTE_UNVERIFIED | The quote couldn’t be verified, so no deposit address was shown. Trying again usually works. |
| RATE_LIMITED | Too many requests in a short time. The payer is asked to wait a minute. |
| REQUEST_TIMEOUT | The API didn’t answer within 20 seconds. |
| NETWORK_ERROR | The API couldn’t be reached. |
| VALIDATION_ERROR | The API found the request malformed. |
| STATUS_CHECK_FAILED | A status check failed. Thrown by getExecutionStatus. The button does not pass it to onError: it keeps checking, and tells the payer after three failures in a row. |
| DEPOSIT_SUBMISSION_FAILED | Reporting a deposit’s transaction failed. Thrown by submitDepositTx. |
| INTERNAL_ERROR | The API failed unexpectedly. |
| UNKNOWN_ERROR | Anything else. |