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:

FieldWhat it is
codeWhat happened. The codes are listed below.
fixableBydeveloper, payer or service.
messageA sentence that is safe to show the payer.
detailsMore for you: what to change, or the route’s own answer.
statusThe HTTP status, when the API answered.

What the payer sees depends on fixableBy:

fixableByMeaningThe payer sees
developerYour setup is wrong.A neutral “payments are not available” message. The reason is in details and in the browser console.
payerThe payer can change something.A sentence saying what, such as the minimum amount.
serviceNobody 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.
codeCause
MISSING_RECIPIENTrecipient is missing or empty.
INVALID_RECIPIENTrecipient has spaces around it, or on an EVM chain is not 0x and 40 hex characters.
INVALID_DESTINATION_TOKENdestinationToken is missing or is not a supported token name.
INVALID_AMOUNTamount is set but is not a string holding a positive number, or has more decimals than the token.
SECRET_KEY_AS_APP_IDA secret key was passed as appId. It is never sent.
APP_ID_REQUIREDThe 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.

codeCause
APP_NOT_FOUNDThe App ID is unknown, mistyped or switched off. Copy it again from the dashboard.
ORIGIN_NOT_ALLOWEDThe 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_ALLOWEDThe app only accepts payments to listed addresses, and the recipient isn’t one of them.
INVALID_RECIPIENTThe recipient is not a valid address for the destination chain. Chains other than EVM are checked here.
RECIPIENT_NOT_READYThe recipient can’t receive the token yet, for example a Stellar account without a trustline.

The payer’s input

codeCauseThe payer is told
INVALID_INPUTThe amount typed is not a number, or has more decimals than the token.What to enter.
NO_LIQUIDITYThere is no route for that pair at that size right now.To try a smaller amount or another network.
AMOUNT_TOO_LOWThe amount is below the route’s minimum.That it is too small, with the minimum when the route gives one.
INVALID_REFUND_ADDRESSThe refund address is not valid for the chain they pay from.That the refund address is not valid.

After the payer has sent funds

codeCause
PAYMENT_REFUNDEDThe swap could not complete and the funds were refunded. See Refunds for where they go.
PAYMENT_FAILEDThe swap failed.

The service

codeCause
QUOTE_FAILEDThe route refused the quote for a reason not listed above. details has its answer.
QUOTE_UNVERIFIEDThe quote couldn’t be verified, so no deposit address was shown. Trying again usually works.
RATE_LIMITEDToo many requests in a short time. The payer is asked to wait a minute.
REQUEST_TIMEOUTThe API didn’t answer within 20 seconds.
NETWORK_ERRORThe API couldn’t be reached.
VALIDATION_ERRORThe API found the request malformed.
STATUS_CHECK_FAILEDA 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_FAILEDReporting a deposit’s transaction failed. Thrown by submitDepositTx.
INTERNAL_ERRORThe API failed unexpectedly.
UNKNOWN_ERRORAnything else.