Skip to main content

Transaction Response Codes

Error Handling

The TapOnMobileSDK uses a unified error handling mechanism through the TapOnMobileError enum. All asynchronous operations return a Result type that, in case of failure, contains a specific TapOnMobileError. This section categorizes these errors, explains their causes, and provides recommended actions for integrators.

Error categories:

The TapOnMobileError enum is categorized into several cases to help identify the source of the issue:

Below can be found the specification of TapOnMobileError, which is an enum that contains all errors returned by the TapOnMobile SDK.

1. Common Errors (.common)

Generic errors that can occur across various features.

Error caseDescriptionRecommended action
unsupportedThe requested service type is not supportedCheck device compatibility or terminal configuration. Hide unsupported features from the UI.
notAllowedThe action is not allowed in the current state.Ensure the app flow is correct and terminal configuration (e.g., QR payment service called when APM is not enabled in the current terminal).
tippingNotAllowedTipping is disabled on this terminal configuration.Do not prompt the user for a tip amount.
timeoutThe operation took too long to complete.Retry the operation or check network stability.
internalErrorAn internal error occurred within the payment service or SDK.Retry the operation. If it persists, contact support.
tokenErrorError during token encryption/decryption.Re-authenticate or restart the session.
invalidAmountThe provided transaction amount is invalid.Validate input before calling the SDK.
invalidTransactionIdThe provided transaction ID format is incorrect.Ensure the ID matches the expected format (UUID).
invalidPasswordThe password provided does not match the merchant portal's password for the selected refund.Prompt the user to re-enter the correct password.
referenceFieldTooLongThe reference string exceeds the allowed character limit.Truncate or validate the reference string before sending.
readerBusyWarningThe card reader is currently busy.This is usually temporary. Wait a moment and retry or ignore if it's a non-blocking warning.
missingRequiredFilterParameterRequired filters (transactionId or reference) were missing for fetching details.Ensure at least one unique identifier is provided.

2. Session Errors (.session)

Errors related to user authentication and terminal registration status.

Error caseDescriptionRecommended action
sessionErrorThe request failed due to missing or invalid authentication credentials.Prompt the user to log in again.
invalidCredentialsThe provided credentials (secure code, etc.) are incorrect.Ask the user to verify and re-enter their credentials.
terminalUnregisteredThe device has been manually unregistered from the merchant portal or the session is invalidated.Restart the registration process.

3. Backend Errors (.backend)

Issues arising from network communication or server responses.

Error caseDescriptionRecommended action
networkErrorNetwork connection failed or was lost.Check internet connectivity and retry.
invalidRequestErrorThe request was malformed.Check SDK configuration and update to the latest version.
invalidResponseReceived a non-HTTP or malformed response from the server.Retry later; if persistent, contact support.
serverError(code, description)The server returned an error.Display the description to the user or handle specific codes (e.g., insufficient funds).
mtlsErrorIndicates that the MTLS check failedPerforming a fresh re-registration. Please unregister the terminal and then complete the registration process

4. Initialization Errors (.initialization)

Errors occurring during the SDK setup phase.

Error caseDescriptionRecommended action
initializationNotCompletedA method was called before initialization() completed successfully.Ensure initialization() is called and returns success before using other SDK features.
initializationAlreadyCompletedinitialization() was called more than once.Check your app logic to ensure initialization runs only once per session.
invalidCertificateDataThe provided certificate data is invalid.Verify the certificate parameters passed to initialization().
invalidEnvironmentAn invalid environment was selected.Use a valid Environments enum value

5. Location Errors (.location)

Issues related to device location services, which are required for transactions.

Error caseDescriptionRecommended action
locationUnauthorizedThe app does not have permission to access location.Prompt the user to enable location permissions in iOS Settings.
validLocationNotFoundThe device could not determine its location.Ensure the user is in an area with GPS/Wi-Fi signal and retry.
countryNotPermittedThe device is in a country where the service is not permitted.Inform the user that the service is unavailable in their current location.

6. Local storage Errors (.local)

Issues accessing data stored on the device.

Error caseDescriptionRecommended action
itemNotFoundA requested item (e.g., cached transaction) was not found.Handle as a "not found" state in your UI. If error persist re-authenticate.
alreadyLogOutAttempted an action requiring a session after logout.Redirect to the login screen.

7. Card Reader Session Errors (.cardReaderSession)

These errors typically occur during device initialization or when calling prepareDevice(). They indicate issues with the environment, merchant account linking, or device state that prevent a reading session from being established. Bellow the recommended actions provided by Apple:

Error caseDescriptionRecommended action
accountNotLinkedMerchant has not accepted the Terms of Service with a valid Apple IDCall prepareDevice() to prompt T&C acceptance or notify the merchant.
accountLinkingFailedSystem failed to link the merchant using the provided Apple ID.Advise the merchant to try again.
accountLinkingRequiresICloudSignInMerchant must be signed into iCloud to accept Terms of Service.Advise the merchant to sign into iCloud.
networkAuthenticationErrorAuthentication error during connection to Apple servers.Check network settings and try again.
networkErrorGeneral network connectivity issue.Check network settings and try again.
osVersionNotSupportedCurrent iOS version does not support Tap to Pay on iPhone.Advise merchant to update iOS to the latest version.
passcodeDisabledDevice passcode is disabled (required for secure element).Advise merchant to enable a device passcode.
deviceBannedDevice is temporarily banned due to eligibility criteria failure.Inform the merchant of the date when it will be usable again.
invalidMerchantMerchant identity is invalid or unknown.Verify merchant configuration and login again.
merchantBlocked Merchant is blocked from using Tap to Pay.Advise merchant to contact support.
notReadyReader session is not ready.Call prepareDevice() to open a new session.
prepareFailedInternal failure during device preparation.Retry the operation; if it persists, contact support.
serviceConnectionErrorInternal system service is unavailable.Inform the merchant that Tap to Pay is currently unavailable.
tokenExpiredThe session token has expired.Do login and call prepareDevice().
readerMemoryFullReader's internal secure memory is full.Advise merchant to remove some cards from Wallet or factory reset.
modelNotSupportedThe iPhone model does not support Tap to Pay.Do not offer Tap to Pay as an option on this device.
notAllowedEntitlement, configuration, or app bundle issue.Verify app entitlements and project configuration.
unsupportedGeneral "Unsupported" state for the hardware/region.Check if the region and device are supported for Tap to Pay.

Note: The readerBusy error from PaymentCardReaderError is automatically mapped to TapOnMobileError.common(.readerBusyWarning) by the SDK.

8. Card Read Errors (.cardRead)

These errors occur during an active payment or refund process (e.g., within doPayment() or doRefund()) after the reader UI has been presented to the customer. Bellow the recommended actions provided by Apple:

Error CaseDescriptionRecommended Action
cardNotSupportedThe card is not supported by the current configuration.Inform the user their card is not supported and suggest using a different payment method.
cardReadFailedAn error occurred when reading the card data.Prompt the user to hold the card correctly and try again. If it fails, suggest using a different card.
invalidAmountThe request contained an invalid amount (e.g., negative).This is an app validation issue. The app should prevent invalid amounts from being submitted.
invalidCurrencyCodeThe request included an invalid currency code.This is a developer configuration/validation issue that should be fixed in the app.
invalidPreferredAIDThe preferred AID/RID specified in the configuration is invalid.This is a developer configuration error that needs to be fixed.
invalidVASMerchantsThe specified list of VAS (Value-Added Service) merchants is invalid.This is a developer configuration error that needs to be fixed.
invalidVASRequestParametersThe specified VAS (Value-Added Service) parameters are invalid.This is a developer configuration error that needs to be fixed.
noReaderSessionNo reader session is available or the session isn't ready.Do login and call prepareDevice().
nfcDisabledNFC is disabled on the device.Prompt the user to enable NFC in their device settings.
passcodeDisabledRead operations are not allowed when the device's passcode is disabled.Prompt the user to enable the passcode in their device settings.
paymentCardDeclinedThe transaction was declined by the card issuer.Inform the user the payment was declined and suggest trying a different card.
paymentReadFailedAn internal failure prevented the payment from being read.Ask the user to try again or use a different payment card.
pinCancelledThe PIN entry was cancelled by the user or system.No action needed as this was a cancellation. Return to the previous screen.
pinEntryFailedAn error occurred when capturing the PIN.Inform the user the PIN entry failed and to try the transaction again.
pinEntryTimeoutThe PIN was not entered within the allowed time.Inform the user that the time for PIN entry expired and to try the transaction again.
pinNotAllowedPIN capture is not supported or has expired for this transaction.Inform the user that PIN entry is not available for this payment method.
pinTokenInvalidAn error indicates an invalid PIN token was used.This is a developer/backend security issue that needs to be investigated.
readCancelledThe read operation was cancelled by the user.No action is needed as this was a user-initiated action. Return to the checkout screen.
readFromBackgroundErrorThe app attempted a read operation while in the background.Ensure the user brings the app to the foreground to complete the payment.
readNotAllowedThe read operation isn't allowed, often due to an entitlement issue.The app should handle this state gracefully, likely by re-initializing the payment flow.
readNotAllowedDuringCallRead operations are not allowed during a phone call.Prompt the user to end the phone call and then try the payment again.
readerInitializationFailedThe reader failed to initialize.This is a critical error. Call prepareDevice() or prompt the user to restart.
readerNotAvailableThe reader is temporarily unavailable.Inform the user the reader is temporarily unavailable and to try again shortly.
readerServiceConnectionErrorThe app was unable to connect to the system's reader services.Call prepareDevice() again after 30 seconds.
readerServiceErrorA general internal reader service error occurred.Call prepareDevice() again after 30 seconds.
readerSessionAuthenticationErrorAn authentication error occurred while refreshing the reader session.Call prepareDevice() again after 30 seconds.
readerSessionBusyThe reader is busy with another operation (e.g., two taps at once).This is an internal app logic issue. Ensure the app handles one transaction at a time.
readerSessionExpiredThe reader session has expired and could not be refreshed.Do login and call prepareDevice().
readerSessionNetworkErrorA network error prevented the reader session from refreshing.The app should try to call prepareDevice(). The user may need to check their internet connection.
readerTokenExpiredThe configuration token for the reader session has expired.Do login and call prepareDevice().
storeAndForwardDeclineFailedAn offline decline request was made after the allowed time window.This is an internal processing error for offline transactions. No specific user action.
storeAndForwardResultNotFoundThe framework could not find the original result for an offline decline.This is an internal processing error for offline transactions. No specific user action.
unknownAn unexpected error occurred.Display a generic error message and provide a way for the user to report the issue if it persists.
vasReadFailAn error occurred when reading a loyalty pass.Inform the user the loyalty pass could not be read and to try again.

9. Unknown Error (.unknown)

Unexpected errors that do not fit other categories.

Action: Log the error details and contact support if it affects critical flows.

Annex: Transaction Response Codes

Both TransactionDetail and APMTransaction have a parameter called Response Code which returns the number corresponding to the transaction response:

  • If the transaction code is 0:
    • transaction response approved
  • If the transaction code is one of [06, 09, 21, 58, 97, 98, 99]:
    • transaction response technical error
  • If the transaction code is 10:
    • transaction response partial approval
  • If the transaction code is 11:
    • transaction response invalid transaction
  • If the transaction code is 33:
    • transaction response expired card
  • If the transaction code is 43:
    • transaction response not permitted
  • If the transaction code is 55:
    • transaction response incorrect pin
  • If the transaction code is 56:
    • transaction response invalid card
  • If the transaction code is 60:
    • transaction response pin required
  • If the transaction code is 61:
    • transaction response insufficient funds
  • If the transaction code is 67:
    • transaction response exceeds withdrawal amount
  • If the transaction code is 77:
    • transaction response pin try limit
  • If the transaction code is 86:
    • transaction response exceeds withdrawal frequency
  • If the transaction code is 87:
    • transaction response approved purchase_only
  • For any other transaction code (default case):
    • transaction response declined