> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Validation

> Field-level validation errors and input element types for form validation

> [!WARNING]
>
> Primer Checkout Android SDK is currently in **beta** (v3.0.0-beta.8).
> The API is subject to change before the stable release.

Field-level validation errors reported through `PrimerCardFormController.State.fieldErrors`.

## SyncValidationError

```kotlin theme={"dark"}
class SyncValidationError {
    val inputElementType: PrimerInputElementType
    val errorId: String
}
```

| Property | Type | Description |
| - | - | - |
| `inputElementType` | `PrimerInputElementType` | Field that triggered the error |
| `errorId` | `String` | Error identifier or message describing the validation failure |

## PrimerInputElementType

```kotlin theme={"dark"}
enum class PrimerInputElementType {
    CARD_NUMBER, EXPIRY_DATE, CVV, CARDHOLDER_NAME,
    COUNTRY_CODE, FIRST_NAME, LAST_NAME,
    ADDRESS_LINE_1, ADDRESS_LINE_2, CITY, STATE, POSTAL_CODE,
}
```

| Value | Validation |
| - | - |
| `CARD_NUMBER` | Luhn check + card network detection |
| `EXPIRY_DATE` | MM/YY format, future date |
| `CVV` | Correct length for card network (3 or 4 digits) |
| `CARDHOLDER_NAME` | Non-empty when required |
| `COUNTRY_CODE` | ISO 3166-1 alpha-2 |
| `FIRST_NAME` | Non-empty |
| `LAST_NAME` | Non-empty |
| `ADDRESS_LINE_1` | Non-empty |
| `ADDRESS_LINE_2` | Optional |
| `CITY` | Non-empty |
| `STATE` | Non-empty |
| `POSTAL_CODE` | Format varies by country |

## Validation timing

Fields validate **on blur** (when the user leaves a field), not while typing.

> [!NOTE]
>
> `isFormValid` updates in real-time as the user types. `fieldErrors` only updates on blur. Use `isFormValid` for submit button state and `fieldErrors` for error messages.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.