Errors thrown or returned from the Primer SDK can be cast to PrimerError
. PrimerError
is an enum containing information that will help you debug issues.
1 2 3 4 5 6 7 protocol PrimerErrorProtocol : CustomNSError , LocalizedError { var errorId : String { get } var exposedError : Error { get } var info : [ String : Any ] ? { get } var diagnosticsId : String { get } var analyticsContext : [ String : Any ] { get } } swift
copy
Properties A unique error identifier.
The error description.
A unique diagnostics id for the given error.
A recovery suggestion for the given error. In case it's present, use it to try to recover from error.
Additional context for analytics purposes.
💡 List of the Component validation errors can be found here .
Error ID Description Recovery Suggestion missing-configuration
Returned when the internal SDK configuration is not present. Check if you have an active internet connection. invalid-client-token
Returned when the provided client token does not have a valid JWT format. Ensure that the client token fetched from your backend is a valid client token (i.e. not null, not blank, is valid JWT and it comes from Primer) expired-client-token
Returned when the provided client token has expired. Avoid storing client tokens locally. Fetch a new client token to provide on when starting Primer. missing-sdk-dependency
Returned when an SDK dependency is missing for a payment method type. Follow the integration guide and include missing dependency.
Error ID Description Recovery Suggestion bad-network
Indicates a connectivity issue. Check your internet connection and try again.
Error ID Description Recovery Suggestion unauthorized
Indicates that the SDK's request lacks valid authentication credentials (HTTP 401). Check the server's response to debug this error further. client-error
Indicates an error caused by the SDK's request (HTTP 4xx). Check the server's response to debug this error further. server-error
Indicates an error caused by the server while processing the SDK's request (HTTP 5xx). Check the server's response to debug this error further.
Error ID Description Recovery Suggestion payment-failed
Returned when processing a payment has failed. Contact Primer and provide us with diagnostics id. failed-to-create-payment
Returned when there is a failure in the internal SDK create payment call. Contact Primer and provide us with diagnostics id. failed-to-resume-payment
Returned when there is a failure in the internal SDK resume payment call. Contact Primer and provide us with diagnostics id. payment-cancelled
Returned when the payment was cancelled by the user. N/A
Error ID Description Recovery Suggestion huc-initialization-failed
Returned when Headless Universal Checkout failed to initialize during the start call. Ensure you are calling start
method before calling this method. invalid-raw-type-data
Returned when the wrong data type is being passed to the raw data setter. Verify the data type being passed and correct it. invalid-raw-data
Returned when the submit method was called without a prior call to the raw data setter. Ensure setRawData
is called with valid data before calling submit
.
Error ID Description Recovery Suggestion apple-pay-timed-out
Indicates that the Apple Pay request timed out. Make sure you have an active internet connection and your Apple Pay configuration is correct. unable-to-present-apple-pay
Indicates that the Apple Pay sheet failed to display. Ensure device supports Apple Pay and that it is setup correctly. Check debug console for system errors.
Error ID Description Recovery Suggestion klarna-user-not-approved
Returned when the user declined the Klarna transaction. N/A klarna-sdk-error
Returned when there is an internal error returned by the Klarna SDK. N/A
Error ID Description Recovery Suggestion payment-failed
Returned when processing a payment has failed. N/A ipay-sdk-connection-error
Returned when there is an internal connection error returned by iPay88. Check the network connection and retry.
Error ID Description Recovery Suggestion nol-pay-sdk-error
Returned when there is an error returned by Nol Pay. Errors can be distinguished by errorCode
: Specific recovery suggestions based on the errorCode
: - A3300
: Failed to init Transit SDK - A3300
: Ensure the Transit SDK is correctly initialized and try again. - A3301
: Error on request parameter - A3301
: Contact Primer and provide us with diagnostics id. - A3302
: Network error - A3302
: Check network connection and retry. - A3304
: Failed to handle response payload - A3304
: Contact Primer and provide us with diagnostics id. - A3305
: API call failed - A3305
: Contact Primer and provide us with diagnostics id. - A3310
: Mobile phone does not support NFC - A3310
: Ensure the mobile phone supports NFC and retry. - A3311
: NFC disabled on mobile phone - A3311
: Enable NFC on the mobile phone and retry. - A3312
: Invalid NFC Tag - A3312
: Verify the NFC tag and retry. - A3313
: NFC disconnected, user should hold Nol card until scanning finishes - A3313
: Hold the Nol card steady until scanning finishes. - A3314
: NFC Command error - A3314
: Contact Primer and provide us with diagnostics id.
Error ID Description Recovery Suggestion failed-to-create-session
Returned when the Universal Checkout failed to create a session with 3rd party sides (e.g., Klarna, PayPal, etc.). Ensure that the Payment method is configured correctly on the dashboard (https://dashboard.primer.io/ )
Error ID Description Recovery Suggestion invalid-value
Returned when the required data for specific use cases has an invalid format or is missing. Verify the data format and ensure all required data is provided. invalid-client-session-value
Returned when the required client session data for specific use cases has an invalid format or is missing. Verify the client session data format and ensure all required data is provided when calling Create a client session API call. failed-to-update-client-session
Returned when the client session fails to update (e.g., selecting a payment method due to a surcharge being present, updating the billing address captured from Google Pay). Check the session update parameters and retry. unknown-error
Returned when the SDK catches an unmapped Exception
. Contact Primer and provide us with diagnostics id.