Skip to content

Errors

How Cash App failures surface and what to do at each step.

How errors surface

  1. Thrown errorsgetSupportedAssets and createOrder reject with ConnectSdkError (stable code).
  2. EventscashApp:orderFailed and cashApp:orderExpired are not thrown errors, but you must handle them in UI; completion comes via cashApp:orderCompleted.

Branch on code, not on message text:

ts
import {
  ConnectSdkError,
  ConnectSdkErrorCode,
} from '@swapped/connect-sdk';

try {
  await client.cashApp.createOrder({
    /* amountFiat, destinationAsset, destinationChain */
  });
} catch (error) {
  if (!(error instanceof ConnectSdkError)) {
    throw error;
  }

  switch (error.code) {
    case ConnectSdkErrorCode.SESSION_NOT_ACTIVE:
      await client.restartSession();
      break;
    default:
      // API_ERROR / unknown — generic retry
      break;
  }
}

client.cashApp.onOrderFailed(() => {
  // Not a thrown error — show failed UI
});

client.cashApp.onOrderExpired(() => {
  // Not a thrown error — show expired UI
});

When things fail in the flow

StepWhat goes wrongHow you see itWhat to do in UI
Load assetsAPI / network failureAPI_ERRORRetry; keep Cash App selected
Create orderSession already completedSESSION_NOT_ACTIVErestartSession() first
Create orderSession not loadedSESSION_REQUIREDloadSession()
Create orderAPI rejection (amount, etc.)API_ERRORShow message; fix amount / retry
WaitingPayment failedcashApp:orderFailedFailed UI; create a new order
WaitingOrder timed outcashApp:orderExpiredExpired UI; create a new order
After successCreate again without restartSESSION_NOT_ACTIVErestartSession()

Amount below minAmountFiat should be blocked in the form before createOrder. Provider-side amount errors still surface as API_ERROR.

Error code reference

CodeWhen it happensWhat to do
SESSION_REQUIREDNo loaded sessionCall loadSession()
SESSION_NOT_ACTIVESession cannot accept a new paymentrestartSession() before createOrder
API_ERRORAssets / create HTTP failureRetry; keep user on a safe step
CLIENT_DESTROYEDClient already destroyedCreate a new client