# Response and Error Codes

The Get Mini Android SDK uses a structured error system to distinguish between successful operations, user cancellations, technical failures, and financial denials. Understanding these response codes and error categories helps you implement appropriate error handling and provide clear feedback to users.

## RepositoryResult Response Types

All SDK operations return results wrapped in the `RepositoryResult` sealed class. The result type indicates the high-level outcome of the operation.

| Result Type | Description | When It Occurs |
| :---- | :---- | :---- |
| `RepositoryResult.Success` | Operation completed successfully with result data | Transaction approved, initialization succeeded, device connected |
| `RepositoryResult.Error` | Operation failed due to technical error or validation failure | Network error, PIN pad disconnected, invalid parameters, communication timeout |
| `RepositoryResult.Cancelled` | User cancelled the operation | Customer pressed cancel on PIN pad, user navigated away from payment screen |

Check the result type first before accessing data or error messages to ensure proper type safety in your implementation.

## PaymentResult Types

For payment operations specifically, successful results (`RepositoryResult.Success`) contain a `PaymentResult` that indicates the transaction outcome.

| Payment Result | Description | Next Steps |
| :---- | :---- | :---- |
| `PaymentResult.Accepted` | Transaction authorized and approved by payment host | Save authorization code and operation ID, provide receipt to customer |
| `PaymentResult.Denied` | Transaction declined by payment host or issuer | Display decline reason to customer, offer alternative payment method |

Payment denials are considered "successful" SDK operations (the communication succeeded) but represent business-level rejections from the payment network.

## Authorization Response Codes

When a transaction is denied (`PaymentResult.Denied`), the `responseCode` field contains a code from the payment authorization host indicating the specific reason for denial.

### Success Codes

| Code Range | Meaning | Description |
| :---- | :---- | :---- |
| 0000-0099 | Approved | Transaction successfully authorized. Proceed with fulfillment. |

### Card Issues

| Code | Meaning | Recommended Action |
| :---- | :---- | :---- |
| 0101 | Card Expired | Request alternative payment method. Card expiration date has passed. |
| 0102 | Card Blocked | Advise customer to contact their card issuer. Card is temporarily or permanently blocked. |
| 0106 | Incorrect PIN Attempts | Card locked due to multiple incorrect PIN entries. Customer must contact issuer. |
| 0202 | Card Restricted | Card has restrictions preventing this transaction type. Request different card. |

### Insufficient Funds

| Code | Meaning | Recommended Action |
| :---- | :---- | :---- |
| 0180 | Insufficient Funds | Not enough available balance or credit. Request alternative payment method. |
| 0184 | Card Limit Exceeded | Transaction amount exceeds card's transaction limit. Try lower amount or different card. |

### Transaction Issues

| Code | Meaning | Recommended Action |
| :---- | :---- | :---- |
| 0190 | General Denial | Issuer declined without specific reason. Request alternative payment method. |
| 0912 | Issuer Unavailable | Cannot reach card issuer's authorization system. Retry after delay or use different card. |
| 9102 | Invalid Transaction | Transaction parameters invalid or not supported. Verify amount and configuration. |

### Authentication Errors

| Code | Meaning | Recommended Action |
| :---- | :---- | :---- |
| 0184 | PIN Error | Incorrect PIN entered. Allow customer to retry PIN entry. |
| 0191 | Authentication Failed | Transaction authentication failed. Request alternative payment method. |

<Callout type="note">

Response codes may vary depending on your payment processor and acquirer configuration. Consult with Get Mini support for processor-specific code mappings relevant to your merchant account.

</Callout>

## SDK Technical Error Messages

| Code | Identifier | Cause | Description / Resolution |
| :---- | :---- | :---- | :---- |
| `1004` | `noInternetConnection` | No internet connectivity | Verify the device has an active internet connection. |
| `1005` | `unrealizedOperation` | Operation not realized | General failure indicating the operation did not complete. |
| `1006` | `transactionDeniedInPinPad` | Offline EMV denial | The transaction was denied offline by the card chip. |
| `1007` | `signatureTooBig` | Signature image too large | The captured signature image exceeds the 4999-byte limit for host upload. |
| `1008` | `genericError` | Generic error | General failure; check request data and logs. |
| `1009` | `communicationWithPinPadFailed` | PIN pad connection lost | The Bluetooth connection with the Get Mini PIN pad was lost or interrupted. |
| `1010` | `communicationWithWebServiceFailed`| Web service connectivity | Failure communicating with the payment host or processing servers. |
| `1011` | `malformedPinPadResponse` | Invalid PIN pad response | The response received from the PIN pad is technically malformed. |
| `1012` | `malformedPinPadConfirmation`| Invalid confirmation | The confirmation message from the PIN pad is malformed. |
| `1013` | `unInitializedPinPad` | PIN pad not initialized | Call `inicializarPinpad()` before processing any transactions. |
| `1014` | `incorrectSignatureValidation` | Integrity check failure | Validation of the host response integrity failed. |
| `1015` | `invalidSelectionDccCurrency` | DCC currency error | The currency selection for Dynamic Currency Conversion is invalid. |
| `1016` | `unInitializedPinpadByFailedUpdate`| Failed parameter load | Parameters could not be loaded during PIN pad initialization. |
| `1017` | `unInitializedPinpadByFailedTDES` | Failed TDES load | Security keys (TDES) could not be loaded during initialization. |
| `1018` | `pinpadInitializationNotFinished` | Partial initialization | The PIN pad initialization process did not reach completion. |
| `1019` | `pinpadWithOutKeys` | Missing symmetric keys | The terminal is not operative because it lacks internal symmetric keys. |
| `1020` | `invalidPUPVersion` | Protocol version mismatch | The PIN pad's protocol version is incompatible with this SDK version. |
| `1021` | `serverResponseWithError` | Server error response | The payment server returned a structured error; check request data. |
| `1022` | `invalidTerminalForOperation` | Invalid terminal status | The terminal selected is not valid for the requested operation. |
| `1023` | `terminalWithoutPermission` | Permission denied | The merchant account/terminal lacks permission for this feature. |
| `1024` | `creditCardNotValid` | Invalid card read | The card presented is not valid or cannot be processed. |
| `1025` | `misApplication` | Application error | Incorrect application selected during card reading. |
| `1026` | `misCodeDeferPayment` | Invalid installment code | The selected installment (Cuotas) code is not valid. |
| `117` | `pinIncorrecto` | Incorrect PIN | The customer entered an incorrect PIN during online authorization. |
| `195` | `repetirLectura` | Repeat card read | Instruct the user to repeat the card reading process (Chip or Double Tap). |
| `196` | `pinTitular` | PIN required | Request PIN from the cardholder (1 Tap). |
| `1055` | `noManualEntryEnabled` | Manual entry disabled | Merchant is not configured to allow manual card entry. |
| `1057` | `operationNotFound` | Operation not found | Cannot perform an action on a non-existent or failed transaction. |

Always log error messages for debugging and support purposes while displaying user-friendly alternatives to customers.

## PIN pad-Specific Errors

Additional errors specific to Bluetooth PIN pad operations and peripheral management.

| Error Type | Description | Resolution |
| :---- | :---- | :---- |
| Pairing Failed | Cannot establish Bluetooth connection with PIN pad | Verify PIN pad is in pairing mode, check device Bluetooth is enabled, retry pairing process |
| Battery Critical | PIN pad battery too low for transaction | Charge PIN pad device before attempting transactions |
| Firmware Incompatible | PIN pad firmware version incompatible with SDK | Update PIN pad firmware through Get Mini support tools |
| Device Busy | PIN pad currently processing another operation | Wait for current operation to complete before initiating new transaction |

## Offline Denial Codes
 
 Additional errors specific to Bluetooth PIN pad operations and peripheral management.
 
### EMV Offline Denials (Section 5.1)

When a transaction is denied locally by the card chip without going online, the following codes may be returned:

| Code | Technical Identifier | Description |
| :---- | :---- | :---- |
| `0` | `DENEGADA_OFF_IMPORTE_O` | Importe menor o igual a cero. |
| `-1` | `DENEGADA_OFF_PAIS_O_MONEDA_EXTRANJERO` | Foreign currency/country not allowed offline. |
| `-2` | `DENEGADA_OFF_BLOQUE_PIN` | Card blocked due to PIN attempts. |
| `-3` | `DENEGADA_OFF_LIMITE_IMPORTE_SUPERADO` | Transaction amount exceeds offline limit. |
| `-4` | `DENEGADA_OFF_LIMITE_OPERACIONES_SUPERADO`| Number of offline transactions exceeded. |
| `-5` | `DENEGADA_OFF_OPERACION_BANDA_NO_PERMITIDA` | Magstripe (MSR) not allowed offline. |
| `-6` | `DENEGADA_OFF_ENTRADA_MANUAL_NO_PERMITIDA` | Manual entry not allowed offline. |
| `-7` | `DENEGADA_OFF_TARJETA_CADUCADA` | Card is expired. |
| `-8` | `DENEGADA_APLICACION_NO_PERMITIDA` | AID not in whitelist. |
| `-9` | `DENEGADA_OPERACION_NO_PERMITIDA` | Unrecognized reading type. |
| `-10` | `DENEGADA_9F27` | Transaction type 9F27 denied by card. |
| `-11` | `DENEGADA_TARJETA_PRIVADA` | Private/non-financial card not allowed. |
| `-12` | `DENEGADA_OPERACION_MOVIL_NO_AUTENTICADA` | Mobile payment lacks authentication. |
| `-14` | `DENEGADA_OFF_LIMITE_IMPORTE_ACUMULADO` | Accumulated offline amount limit exceeded. |
| `-16` | `DENEGADA_PIN_OFF_EXCEDIDO` | Offline PIN attempts exceeded. |

## Error Handling Best Practices

When processing errors, consider the error category to provide appropriate user experience and resolution paths:

**Technical Errors (RepositoryResult.Error)**: Log detailed error information for debugging. Display generic user-friendly messages to customers without exposing technical details. Offer retry options for transient failures like network issues.

**Payment Denials (PaymentResult.Denied)**: Display the decline reason from the authorization response. Guide customers to alternative payment methods. Never retry declined transactions automatically without customer action.

**User Cancellations (RepositoryResult.Cancelled)**: Handle gracefully without error messages. Allow customers to retry or choose alternative actions. Log cancellations for business analytics without treating as failures.