DigetPay Logo

Error Handling

Learn how to properly handle errors and exceptions from the SDK to provide a smooth user experience.

Overview

The DigetPay SDK uses a sealed class hierarchy (DigetSposError) and typed exception (DigetSposException) to provide structured, actionable error information.

DigetSposException

Typed exception thrown in catch blocks

DigetSposError

Sealed class hierarchy for structured errors

Response Codes

Server response codes for transaction results

Custom Errors

Plugin-level error categories

DigetSposException

The SDK throws DigetSposException for SDK-specific errors. It wraps an DigetSposError with a typed error category and optional cause.

PropertyTypeDescription
errorDigetSposErrorThe typed error object with code and message
messageString?Human-readable error description
causeThrowable?Underlying cause, if available

DigetSposError Hierarchy

The modern, type-safe error hierarchy used by the SDK. Each subtype carries a numeric code in a specific range.

DigetSposError SubtypeCode RangeCategory
DigetSposError.InitializationError1xxxSDK setup and auth failures
DigetSposError.NetworkError2xxxConnectivity and server communication issues
DigetSposError.CardError3xxxCard reading and NFC issues
DigetSposError.KernelError4xxxEMV kernel processing failures
DigetSposError.TerminalError5xxxTerminal configuration and binding problems
DigetSposError.TransactionError6xxxTransaction processing failures
DigetSposError.AuthenticationError7xxxAuth token or credential issues
DigetSposError.ValidationError8xxxInput/parameter validation failures
DigetSposError.SecurityError9xxxSecurity policy violations

Error Handling Pattern

Use when-expression (Kotlin) or instanceof (Java) to handle each error category precisely.

Loading...

Debug Logging

Enable debug logging during development: DigetSposPlugin.enableLogs(true)

Transaction Response Handling

Handle different transaction outcomes using the TxnResponse callback.

Loading...

Common Errors

Frequently encountered error codes with causes and resolution guidance.

CodeCategoryMeaningResolution
1001InitializationInvalid auth credentialsCheck your authToken or email/password
1002InitializationSDK not initializedCall DigetSposPlugin.initiate() first
1003InitializationNo terminal boundComplete terminal binding in onTerminalBindingTask
2001NetworkNetwork connection timeoutCheck device internet/network connection
2002NetworkServer unreachableVerify API endpoint and network access
3001CardCard read timeoutAsk user to tap card again within timeout window
3002CardUnsupported card typeOnly NFC-capable payment cards supported
3003CardCard communication errorClean card/device NFC area and retry
4001KernelEMV processing failureSync terminal to update EMV parameters
5001TerminalTerminal not activatedCall activateTerminal() first
5002TerminalTerminal binding requiredSelect terminal in onTerminalBindingTask callback
6001TransactionTransaction declinedCard declined by issuer — do not retry
6002TransactionInsufficient fundsCustomer should use different card
6003TransactionTransaction already reversedCannot reverse same transaction twice
7001AuthenticationSession expiredCall initiate() again to create new session
9001SecurityLocation validation failedEnable real device location, disable mock locations
9002SecurityCertificate pinning failureCheck certificate validity and network proxy