Last updated: 30 October 2025 | Change log
Validate your customer's CVC before processing it.
The validation does not check if your customer's CVC are correct. The validation only checks the format of the entered CVC.
The key components for this integration are:
- A reference to your 
AccessCheckoutEditTextfor the CVC - An 
AccessCheckoutCvcValidationListenerdesigned to receive validation events - An instance of 
CvcValidationConfigcontaining all the information required for the initialization of the validation flow, including a reference to the CVC view component to enable validation for - An 
AccessCheckoutClientresponsible for initializing the validation flow 
You can see an example of the CVC validation integration here.
You must reference your view for CVC, as this is required for CVC validation. Instructions can be found here.
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.
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
    }
}| 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. | 
You must first initialize the AccessCheckoutClient using the AccessCheckoutClientBuilder, providing your baseUrl and checkoutId and other parameters. Instructions can be found here.
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.
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<AccessCheckoutEditText>(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)
    }
}Next steps