{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["sub-heading","br","details","admonition"]},"type":"markdown"},"seo":{"title":"Pre-fill billing address checkbox","description":"Transform your commerce with PXP's unified platform—seamless payments, real-time insights, and global growth in one powerful integration.","lang":"en-UK","siteUrl":"https://developer.pxp.io","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"pre-fill-billing-address-checkbox","__idx":0},"children":["Pre-fill billing address checkbox"]},{"$$mdtype":"Tag","name":"SubHeading","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Learn about customisation options for the pre-fill billing address checkbox."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"styling","__idx":1},"children":["Styling"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val prefillBillingAddressCheckboxConfig = PrefillBillingAddressCheckboxConfig(\n    countrySelectionComponent = CountrySelectionComponent?,\n    postcodeComponent = PostcodeComponent?,\n    addressComponent = AddressComponent?,\n    shippingAddress = ShippingAddress?,\n    checked = Boolean,\n    styles = PrefillBillingAddressCheckboxStyle,\n    label = String,\n    initialChecked = Boolean,\n    style = CheckboxStyle?,\n    annotatedLabel = AnnotatedString?,\n    validations = CheckboxValidations\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["countrySelectionComponent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["CountrySelectionComponent?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Country selection component to be prefilled when the checkbox is checked."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["postcodeComponent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PostcodeComponent?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Postcode component to be prefilled when the checkbox is checked."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["addressComponent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["AddressComponent?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Address component to be prefilled when the checkbox is checked."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shippingAddress"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["ShippingAddress?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Shipping address data to use for prefill."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checked"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether the checkbox is initially checked. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["styles"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PrefillBillingAddressCheckboxStyle"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Visual style configuration."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["label"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The label text displayed next to the checkbox. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"Same as shipping address\""]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["initialChecked"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether the checkbox is initially checked when created. Inherited from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckboxConfig"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["style"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["CheckboxStyle?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Styling configuration for the checkbox's appearance. Inherited from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckboxConfig"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["annotatedLabel"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["AnnotatedString?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The rich text label with clickable links, used instead of the plain label when provided. Inherited from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckboxConfig"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["validations"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["CheckboxValidations"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Validation rules and messages for the checkbox component. Inherited from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckboxConfig"]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"callbacks","__idx":2},"children":["Callbacks"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"data class PrefillBillingAddressCheckboxConfig(\n    val onToggleChanged: ((Boolean) -> Unit)? = null,\n    val onFocus: (() -> Unit)? = null,\n    val onBlur: (() -> Unit)? = null,\n    val onFocusChange: ((Boolean) -> Unit)? = null,\n    val onValidationPassed: ((List<ValidationResult>) -> Unit)? = null,\n    val onValidationFailed: ((List<ValidationResult>) -> Unit)? = null,\n    val onTriggerFieldValidation: ((ValidationResult) -> Unit)? = null,\n    val onChange: (() -> Unit)? = null\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Callback"},"children":["Callback"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onToggleChanged: ((Boolean) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Event handler for when the toggle state changes."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onFocus: (() -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Event handler for when the component receives focus."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onBlur: (() -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Event handler for when the component loses focus."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onFocusChange: ((Boolean) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Event handler for when the component's focus state changes."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onValidationPassed: ((List<ValidationResult>) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Event handler for when validation passes."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onValidationFailed: ((List<ValidationResult>) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Event handler for when validation fails."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onTriggerFieldValidation: ((ValidationResult) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Event handler for when field validation is triggered individually."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onChange: (() -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Event handler for when the field value changes."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information about callbacks, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/android/card/events"},"children":["Events"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"example","__idx":3},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"import com.pxp.checkout.components.prefillbillingaddresscheckbox.PrefillBillingAddressCheckboxComponent\nimport com.pxp.checkout.components.prefillbillingaddresscheckbox.PrefillBillingAddressCheckboxConfig\nimport com.pxp.checkout.components.countryselection.CountrySelectionComponent\nimport com.pxp.checkout.components.postcode.PostcodeComponent\nimport com.pxp.checkout.components.address.AddressComponent\nimport com.pxp.checkout.models.ShippingAddress\nimport com.pxp.checkout.styles.PrefillBillingAddressCheckboxStyle\n\n// Create shipping address data\nval shippingAddress = ShippingAddress(\n    countryCode = \"US\",\n    postalCode = \"10001\",\n    address = \"123 Main Street\"\n)\n\n// Optional: Create custom styling\nval customStyle = PrefillBillingAddressCheckboxStyle(\n    colors = PrefillBillingAddressCheckboxStyle.ColorStyles(\n        checkedColor = Color.Blue,\n        uncheckedColor = Color.Gray,\n        checkmarkColor = Color.White\n    ),\n    textStyles = PrefillBillingAddressCheckboxStyle.TextStyles(\n        checkedLabelStyle = TextStyle(\n            color = Color.Blue,\n            fontSize = 14.sp\n        ),\n        uncheckedLabelStyle = TextStyle(\n            color = Color.Black,\n            fontSize = 14.sp\n        )\n    )\n)\n\nval config = PrefillBillingAddressCheckboxConfig(\n    // Component references for prefilling\n    countrySelectionComponent = countrySelectionComponent,\n    postcodeComponent = postcodeComponent,\n    addressComponent = addressComponent,\n    \n    // Shipping address data source\n    shippingAddress = shippingAddress,\n    \n    // Initial state\n    checked = false,\n    label = \"Same as shipping address\",\n    \n    // Styling (optional)\n    styles = customStyle,\n    \n    // Validation (optional)\n    validations = CheckboxValidations(\n        required = \"Please confirm billing address preference\"\n    )\n)\n\nval prefillCheckboxComponent = checkout.createComponent<PrefillBillingAddressCheckboxComponent, PrefillBillingAddressCheckboxConfig>(\n    type = ComponentType.PREFILL_BILLING_ADDRESS_CHECKBOX,\n    config = config\n)\n","lang":"kotlin"},"children":[]}]},"headings":[{"value":"Pre-fill billing address checkbox","id":"pre-fill-billing-address-checkbox","depth":1},{"value":"Styling","id":"styling","depth":2},{"value":"Callbacks","id":"callbacks","depth":2},{"value":"Example","id":"example","depth":2}],"frontmatter":{"seo":{"title":"Pre-fill billing address checkbox"}},"lastModified":"2026-02-26T12:14:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/android/card/pre-fill-billing-address-checkbox","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}