Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.blink.cash/llms.txt

Use this file to discover all available pages before exploring further.

Every error thrown by the Mobile Deposit SDK is a DepositError instance with a machine-readable code property. The error class is the same as the web SDK, but the mobile SDK has additional error codes for browser and deep link failures.

DepositError

import { DepositError, getDisplayMessage } from '@swype-org/deposit-mobile';
class DepositError extends Error {
  readonly code: DepositMobileErrorCode;
  constructor(code: DepositMobileErrorCode, message: string);
}

Error codes

Mobile-specific codes

CodeMeaningUser-facing message
DEPOSIT_DISMISSEDUser dismissed the deposit flow before completing the payment.”The deposit was dismissed before the transfer completed.”
BROWSER_FAILEDFailed to open the in-app browser (e.g. openUrl threw an error).”Unable to open the payment browser. Please try again.”
BROWSER_DISMISSEDDeprecated alias for DEPOSIT_DISMISSED.”The deposit was dismissed before the transfer completed.”
DEEP_LINK_INVALIDThe callback deep link was malformed or missing required parameters.”The payment callback was malformed. Please try again.”

Shared codes (same as web SDK)

CodeMeaningUser-facing message
SIGNER_REQUEST_FAILEDSigner returned a non-2xx response.”Unable to start the payment. Please try again.”
SIGNER_NETWORK_ERRORNetwork failure reaching the signer.”Unable to reach the payment server. Check your connection and try again.”
SIGNER_RESPONSE_INVALIDSigner response missing required fields (merchantId, payload, signature, preview).”The payment server returned an unexpected response.”
SIGNER_TIMEOUTSigner did not respond within signerTimeoutMs.”The payment server took too long to respond. Please try again.”
FLOW_TIMEOUTEntire flow exceeded flowTimeoutMs.”The deposit flow timed out. Please try again.”
INVALID_REQUESTBad input (missing amount, invalid address, destroyed instance, etc.).”Invalid payment request. Please check your input.”

getDisplayMessage

Returns a user-friendly display string for a DepositError. You can show this directly in your UI.
function getDisplayMessage(error: DepositError): string

Usage

import { DepositError, getDisplayMessage } from '@swype-org/deposit-mobile';

try {
  await deposit.requestDeposit({ /* ... */ });
} catch (err) {
  if (err instanceof DepositError) {
    Alert.alert('Payment Error', getDisplayMessage(err));
    console.error(err.code, err.message);
  }
}

Handling specific error codes

try {
  await deposit.requestDeposit({ /* ... */ });
} catch (err) {
  if (!(err instanceof DepositError)) throw err;

  switch (err.code) {
    case 'DEPOSIT_DISMISSED':
      // User intentionally closed, no action needed
      break;
    case 'BROWSER_DISMISSED':
      // Deprecated alias for DEPOSIT_DISMISSED
      break;
    case 'BROWSER_FAILED':
      // Could not open browser, prompt retry or show fallback
      showRetryDialog(getDisplayMessage(err));
      break;
    case 'DEEP_LINK_INVALID':
      // Malformed callback, log for investigation
      reportError(err);
      break;
    case 'SIGNER_REQUEST_FAILED':
    case 'SIGNER_NETWORK_ERROR':
    case 'SIGNER_TIMEOUT':
      // Signer issue, prompt retry
      showRetryDialog(getDisplayMessage(err));
      break;
    case 'SIGNER_RESPONSE_INVALID':
      // Integration bug, log for investigation
      reportError(err);
      break;
    case 'FLOW_TIMEOUT':
      showRetryDialog(getDisplayMessage(err));
      break;
    case 'INVALID_REQUEST':
      showValidationError(getDisplayMessage(err));
      break;
  }
}

DepositMobileErrorCode

The union of all mobile error code strings:
type DepositMobileErrorCode =
  | 'DEPOSIT_DISMISSED'
  | 'BROWSER_FAILED'
  /** @deprecated Use 'DEPOSIT_DISMISSED' instead. */
  | 'BROWSER_DISMISSED'
  | 'DEEP_LINK_INVALID'
  | 'SIGNER_REQUEST_FAILED'
  | 'SIGNER_NETWORK_ERROR'
  | 'SIGNER_RESPONSE_INVALID'
  | 'SIGNER_TIMEOUT'
  | 'FLOW_TIMEOUT'
  | 'INVALID_REQUEST';