**Last updated**: 30 October 2025 | [**Change log**](/products/checkout/android/changelog/) # CVC validation Validate your customer's CVC before processing it. Warning The validation does not check if your customer's CVC are correct. The validation only checks the format of the entered CVC. ## Get started The key components for this integration are: - A reference to your `AccessCheckoutEditText` for the CVC - An `AccessCheckoutCvcValidationListener` designed to receive validation events - An instance of `CvcValidationConfig` containing all the information required for the initialization of the validation flow, including a reference to the CVC view component to enable validation for - An `AccessCheckoutClient` responsible for initializing the validation flow Full sample integration You can see an example of the CVC validation integration [here](https://github.com/Worldpay/access-checkout-android/tree/master/demo-app/src/main/java/com/worldpay/access/checkout/sample). ## Reference your view You must reference your view for CVC, as this is required for CVC validation. Instructions can be found [here](/products/checkout/android/cvc-only#reference-your-views). ## Implement the validation listener To receive validation events as your customer enters their CVC details, you are required to create your own implementation of the `AccessCheckoutCvcValidationListener` interface. Each function of this interface is optional, giving you the flexibility to listen only to the events that are relevant to your application. Kotlin package com.worldpay.access.checkout.sample.code import com.worldpay.access.checkout.client.validation.listener.AccessCheckoutCvcValidationListener class CvcValidationListener : AccessCheckoutCvcValidationListener { // This event listener is notified when the CVC becomes valid or invalid override fun onCvcValidated(isValid: Boolean) { // You might want to change the text color val textColor = if (isValid) Color.GREEN else Color.RED cvcAccessCheckoutView.setTextColor(textColor) // You might want to disable a submit button which would normally be clicked on when all fields are valid if (!isValid) submitBtn.isEnabled = false } // This event listener is notified when CVC is valid override fun onValidationSuccess() { // You might want to enable a submit button when the CVC is valid submitButton.isEnabled = true } } Java package com.worldpay.access.checkout.sample.code import com.worldpay.access.checkout.client.validation.listener.AccessCheckoutCvcValidationListener; public class CvcValidationListener implements AccessCheckoutCvcValidationListener { // This event listener is notified when the CVC becomes valid or invalid @Override public void onCvcValidated(Boolean isValid) { // You might want to change the text color var textColor = isValid ? Color.GREEN : Color.RED; cvcAccessCheckoutView.setTextColor(textColor); // You might want to disable a submit button which would normally be clicked on when all fields are valid if (!isValid) submitBtn.isEnabled = false } // This event listener is notified when CVC is valid @Override public void onValidationSuccess() { // You might want to enable a submit button when the CVC is valid submitButton.isEnabled = true } } ### Function and parameter descriptions | Method | Description | | --- | --- | | `onCvcValidated` | This method is called with the validity of the CVC field. `isValid` indicates whether the field is in a valid or invalid state. | | `onValidationSuccess` | This method is called when the CVC field is in a valid state. You typically use this to enable the submit button. | ## Initialize the `AccessCheckoutClient` and validation You must first initialize the `AccessCheckoutClient` using the `AccessCheckoutClientBuilder`, providing your `baseUrl` and `checkoutId` and other parameters. Instructions can be found [here](/products/checkout/android/cvc-only#initialize-the-accesscheckoutclient). After implementing the `AccessCheckoutCvcValidationListener`, initialize validation for your view by creating a `CvcValidationConfig` using the builder and passing it to the `initialiseValidation` method of `AccessCheckoutClient`. Kotlin package com.worldpay.access.checkout.sample.code // android library imports omitted import com.worldpay.access.checkout.client.AccessCheckoutClient; import com.worldpay.access.checkout.client.AccessCheckoutClientBuilder; import com.worldpay.access.checkout.client.validation.config.CvcValidationConfig; import com.worldpay.access.checkout.client.validation.listener.AccessCheckoutCvcValidationListener; class MainActivity : AppCompatActivity() { private val baseUrl = "TARGET_BASE_URL" private val checkoutId = "YOUR_CHECKOUT_ID" // other fields omitted override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Reference the AccessCheckoutEditText view val cvcAccessCheckoutView: AccessCheckoutEditText = findViewById(R.id.card_flow_text_cvc); // other view references omitted // Initialize the AccessCheckoutClient val sessionResponseListener = MySessionResponseListener() val accessCheckoutClient = AccessCheckoutClientBuilder() .baseUrl(baseUrl) .checkoutId(checkoutId) .context(this) .sessionResponseListener(sessionResponseListener) .lifecycleOwner(this) .build() // Create the validation configuration val cvcValidationListener = CvcValidationListener() val cvcValidationConfig = CvcValidationConfig.Builder() .cvc(cvcAccessCheckoutView) .validationListener(cvcValidationListener) .build() // Initialize validation using the client accessCheckoutClient.initialiseValidation(cvcValidationConfig) } } Java package com.worldpay.access.checkout.sample.code // android library imports omitted import com.worldpay.access.checkout.client.AccessCheckoutClient; import com.worldpay.access.checkout.client.AccessCheckoutClientBuilder; import com.worldpay.access.checkout.client.validation.config.CvcValidationConfig; import com.worldpay.access.checkout.client.validation.listener.AccessCheckoutCvcValidationListener; public class MainActivity extends AppCompatActivity { private String baseUrl = "TARGET_BASE_URL"; private String checkoutId = "YOUR_CHECKOUT_ID"; // other fields omitted @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Reference the AccessCheckoutEditText view AccessCheckoutEditText cvcAccessCheckoutView = findViewById(R.id.card_flow_text_cvc); // other view references omitted // Initialize the AccessCheckoutClient SessionResponseListener sessionResponseListener = new MySessionResponseListener(); final AccessCheckoutClient accessCheckoutClient = new AccessCheckoutClientBuilder() .baseUrl(baseUrl) .checkoutId(checkoutId) .context(this) .sessionResponseListener(sessionResponseListener) .lifecycleOwner(this) .build(); // Create the validation configuration AccessCheckoutCvcValidationListener cvcValidationListener = CvcValidationListener(); CvcValidationConfig cvcValidationConfig = CvcValidationConfig.Builder() .cvc(cvcAccessCheckoutView) .validationListener(cvcValidationListener) .build(); // Initialize validation using the client accessCheckoutClient.initialiseValidation(cvcValidationConfig); } } **Next steps** [Create a CVC session](/products/checkout/android/cvc-only)