VA
Acceptance

Error Codes

All SDK error codes for programmatic error handling.

Type tables on this page are generated directly from the SDK source code at build time.

Error Codes

The SDK uses typed error codes for programmatic error handling:

CodeCategoryDescription
AUTH_FAILEDAuthenticationAuthentication attempt failed
AUTH_TIMEOUTAuthenticationAuthentication timed out (default: 60s)
SESSION_EXPIREDAuthenticationUser session has expired
NETWORK_ERRORNetworkNetwork request failed
API_ERRORNetworkAPI returned an error response
INVALID_CONFIGConfigurationInvalid SDK configuration provided
COMPONENT_LOAD_FAILEDComponentComponent failed to load in iframe
RATE_LIMITEDRate LimitingToo many requests

Error Object

All errors conform to the ComponentError interface:

Prop

Type

Handling Errors

VisaAcceptance.init({
  onError: (error) => {
    switch (error.code) {
      case 'AUTH_FAILED':
        if (error.retryable) {
          showReAuthPrompt();
        }
        break;
      case 'NETWORK_ERROR':
        showRetryBanner();
        break;
      case 'RATE_LIMITED':
        backoff(error.details?.retryAfter);
        break;
      default:
        reportToSentry(error);
    }
  }
});

Retryable Errors

Errors with retryable: true can be recovered from:

  • AUTH_FAILED — prompt user to re-authenticate
  • AUTH_TIMEOUT — retry with longer timeout or prompt login
  • NETWORK_ERROR — retry after brief delay
  • RATE_LIMITED — retry after retryAfter period

Non-retryable errors (INVALID_CONFIG, COMPONENT_LOAD_FAILED) indicate a code or configuration issue that requires a fix.

On this page