{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["sub-heading","br","details","required","admonition"]},"type":"markdown"},"seo":{"title":"Consent component","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":"consent-component","__idx":0},"children":["Consent component"]},{"$$mdtype":"Tag","name":"SubHeading","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Learn about how to configure the PayPal consent checkbox component."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"basic-usage","__idx":1},"children":["Basic usage"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"minimal-configuration","__idx":2},"children":["Minimal configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["At minimum, the PayPal consent component requires the following configuration to function:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val consentConfig = PayPalConsentConfig(\n    label = \"Save my PayPal account for faster checkout\"\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":{"align":"left","data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["label"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The plain text label displayed next to the checkbox. This describes what the user is consenting to."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"advanced-configuration","__idx":3},"children":["Advanced configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more complex implementations, you can configure additional settings:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val consentConfig = PayPalConsentConfig(\n    // Required configuration\n    label = \"Save my PayPal account for faster checkout\",\n    \n    // Rich text support\n    annotatedLabel = buildAnnotatedString {\n        append(\"I agree to save my PayPal account. \")\n        pushStringAnnotation(tag = \"terms\", annotation = \"https://example.com/terms\")\n        withStyle(style = SpanStyle(color = Color.Blue, textDecoration = TextDecoration.Underline)) {\n            append(\"Terms and conditions\")\n        }\n        pop()\n    },\n    \n    // Initial state\n    initialChecked = false,\n    \n    // Validation\n    isRequired = true\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":{"align":"left","data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"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":{"align":"left"},"children":["The rich text label with formatting and hyperlink support. If provided, this overrides the plain ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["label"]},". Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"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":{"align":"left"},"children":["The initial checkbox state. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isRequired"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Whether the consent is required for payment. When ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", validation will ensure the checkbox is checked. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The PayPal consent component uses ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CardConsentStyle"]},", giving you fine-grained control over colours, typography, spacing, and checkbox dimensions."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"styling","__idx":4},"children":["Styling"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"default-styling","__idx":5},"children":["Default styling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The PayPal consent component renders with these default styles:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"paypalStyle = CardConsentStyle(\n    colors = CardConsentStyle.ColorStyles(\n        checkedColor = Color(0xFF0070BA),  // PayPal blue\n        uncheckedColor = Color(0xFF9E9E9E),\n        checkmarkColor = Color.White\n    ),\n    textStyles = CardConsentStyle.TextStyles(\n        textStyle = TextStyle(fontSize = 14.sp)\n    ),\n    spacing = CardConsentStyle.SpacingStyles(\n        horizontalSpacing = 12f\n    ),\n    dimensions = CardConsentStyle.DimensionStyles(\n        checkboxSize = 20f\n    )\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"custom-styling","__idx":6},"children":["Custom styling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can override the default appearance by providing custom styles for any part of the component:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val consentConfig = PayPalConsentConfig(\n    label = \"Save my PayPal account for faster checkout\",\n    paypalStyle = CardConsentStyle.createDefault().apply {\n        // Colour customisation\n        colors = CardConsentStyle.ColorStyles(\n            backgroundColor = Color.White,\n            textColor = Color(0xFF2C2E2F),\n            checkedColor = Color(0xFF0070BA),\n            uncheckedColor = Color(0xFF9E9E9E),\n            checkmarkColor = Color.White,\n            disabledColor = Color(0xFFCCCCCC),\n            errorColor = Color(0xFFDC3545),\n            linkColor = Color(0xFF0070BA)\n        )\n        \n        // Text style customisation\n        textStyles = CardConsentStyle.TextStyles(\n            textStyle = TextStyle(\n                fontSize = 14.sp,\n                fontWeight = FontWeight.Normal\n            ),\n            linkTextStyle = TextStyle(\n                fontSize = 14.sp,\n                fontWeight = FontWeight.Medium,\n                textDecoration = TextDecoration.Underline\n            ),\n            errorStyle = TextStyle(\n                fontSize = 12.sp,\n                color = Color(0xFFDC3545)\n            ),\n            checkedLabelStyle = TextStyle(\n                fontSize = 14.sp,\n                fontWeight = FontWeight.Medium,\n                color = Color(0xFF2C2E2F)\n            ),\n            uncheckedLabelStyle = TextStyle(\n                fontSize = 14.sp,\n                fontWeight = FontWeight.Normal,\n                color = Color(0xFF6C757D)\n            )\n        )\n        \n        // Spacing customisation\n    spacing = CardConsentStyle.SpacingStyles(\n            horizontalSpacing = 12f,\n            verticalSpacing = 8f,\n            errorTextPaddingStart = 32f,\n            errorTextPaddingTop = 4f\n        )\n        \n        // Dimension customisation\n    dimensions = CardConsentStyle.DimensionStyles(\n            checkboxSize = 22f\n        )\n    }\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":{"align":"left","data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["CardConsentStyle"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Custom styling configuration for the PayPal consent component. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CardConsentStyle.createDefault()"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.colors"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["ColorStyles"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Colour-related style configuration."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.colors.backgroundColor"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The background colour of the consent component. Defaults to transparent."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.colors.textColor"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The text colour for the label. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Color.Black"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.colors.checkedColor"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The checkbox colour when checked. Defaults to PayPal blue (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0xFF0070BA"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.colors.uncheckedColor"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The checkbox border colour when unchecked. Defaults to grey (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0xFF9E9E9E"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.colors.checkmarkColor"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The colour of the checkmark inside checkbox. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Color.White"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.colors.disabledColor"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The checkbox colour when disabled. Defaults to light grey."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.colors.errorColor"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The colour for error messages. Defaults to red (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0xFFDC3545"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.colors.linkColor"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The colour for links in the label text. Defaults to PayPal blue."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.textStyles"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TextStyles"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Text-related style configuration."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.textStyles.textStyle"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TextStyle"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The main text style for the label. Defaults to 14sp normal weight."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.textStyles.linkTextStyle"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TextStyle"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The style for clickable links. Defaults to underlined text."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.textStyles.errorStyle"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TextStyle"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The text style for error messages. Defaults to 12sp red text."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.textStyles.checkedLabelStyle"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TextStyle"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The label style when checked. Defaults to medium weight."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.textStyles.uncheckedLabelStyle"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TextStyle"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The label style when unchecked. Defaults to normal weight."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.spacing"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["SpacingStyles"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Spacing-related style configuration."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.spacing.horizontalSpacing"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Float"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The horizontal spacing between the checkbox and the label, in pixels. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["12f"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.spacing.verticalSpacing"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Float"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The vertical spacing between elements, in pixels. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["8f"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.spacing.errorTextPaddingStart"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Float"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The left padding for the error text, in pixels. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["32f"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.spacing.errorTextPaddingTop"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Float"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The top padding for the error text, in pixels. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["4f"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.dimensions"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["DimensionStyles"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Dimension-related style configuration."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalStyle.dimensions.checkboxSize"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Float"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The size of the checkbox in pixels. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["20f"]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"event-handling","__idx":7},"children":["Event handling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The PayPal consent component provides event handlers for user interactions:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val consentConfig = PayPalConsentConfig(\n    onToggleChanged = { isChecked: Boolean -> },\n    onLinkClick = { url: String -> },\n    onTriggerFieldValidation = { result: ValidationResult -> }\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":{"align":"left","data-label":"Callback"},"children":["Callback"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onToggleChanged: ((Boolean) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when the consent checkbox's state changes. The boolean parameter indicates the new checked state."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onLinkClick: ((String) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when links in the consent text are clicked (e.g., terms and conditions). The string parameter contains the URL annotation."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onTriggerFieldValidation: ((ValidationResult) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when validation events occur. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ValidationResult"]}," parameter contains validation status and messages."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For detailed information about event data structures and usage patterns, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/android/paypal/events"},"children":["Events"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"methods","__idx":8},"children":["Methods"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The PayPal consent component provides methods for state management."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"content","__idx":9},"children":["Content()"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Renders the consent checkbox in Jetpack Compose:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"@Composable\nfun ConsentSection() {\n    val consentComponent = remember {\n        pxpCheckout.createComponent(\n            type = ComponentType.PAYPAL_CONSENT,\n            config = consentConfig\n        )\n    }\n    \n    pxpCheckout.buildComponentView(\n        component = consentComponent,\n        modifier = Modifier.fillMaxWidth()\n    )\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getvalue","__idx":10},"children":["getValue()"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieves the current checkbox state:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val isConsentGiven = consentComponent.getValue() as? Boolean ?: false\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":11},"children":["Examples"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"basic-consent-checkbox","__idx":12},"children":["Basic consent checkbox"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A straightforward implementation with essential configuration:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val consentConfig = PayPalConsentConfig(\n    label = \"Save my PayPal account for faster checkout\",\n    initialChecked = false,\n    isRequired = true,\n    \n    onToggleChanged = { isChecked ->\n        Log.d(\"Consent\", \"User consent: $isChecked\")\n        if (isChecked) {\n            // Enable one-click payment features\n            enableOneClickPayment()\n        }\n    }\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"consent-with-terms-and-conditions-link","__idx":13},"children":["Consent with terms and conditions link"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Implementation with rich text and clickable links:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val consentConfig = PayPalConsentConfig(\n    label = \"Save my PayPal account\",\n    annotatedLabel = buildAnnotatedString {\n        append(\"I agree to save my PayPal account. \")\n        pushStringAnnotation(tag = \"terms\", annotation = \"https://example.com/terms\")\n        withStyle(\n            style = SpanStyle(\n                color = Color(0xFF0070BA),\n                textDecoration = TextDecoration.Underline\n            )\n        ) {\n            append(\"Terms and conditions\")\n        }\n        pop()\n        append(\" apply.\")\n    },\n    initialChecked = false,\n    isRequired = true,\n    \n    onToggleChanged = { isChecked ->\n        Log.d(\"Consent\", \"Consent status: $isChecked\")\n        updateConsentPreference(isChecked)\n    },\n    \n    onLinkClick = { url ->\n        Log.d(\"Consent\", \"Opening link: $url\")\n        openExternalBrowser(url)\n    }\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"enterprise-consent-with-custom-styling","__idx":14},"children":["Enterprise consent with custom styling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A comprehensive implementation with full customisation:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val consentConfig = PayPalConsentConfig(\n    label = \"Save my PayPal account for faster checkout\",\n    annotatedLabel = buildAnnotatedString {\n        append(\"I agree to save my PayPal account. By checking this box, I accept the \")\n        pushStringAnnotation(tag = \"terms\", annotation = \"https://example.com/terms\")\n        withStyle(\n            style = SpanStyle(\n                color = Color(0xFF0070BA),\n                textDecoration = TextDecoration.Underline,\n                fontWeight = FontWeight.Medium\n            )\n        ) {\n            append(\"Terms of Service\")\n        }\n        pop()\n        append(\" and \")\n        pushStringAnnotation(tag = \"privacy\", annotation = \"https://example.com/privacy\")\n        withStyle(\n            style = SpanStyle(\n                color = Color(0xFF0070BA),\n                textDecoration = TextDecoration.Underline,\n                fontWeight = FontWeight.Medium\n            )\n        ) {\n            append(\"Privacy Policy\")\n        }\n        pop()\n        append(\".\")\n    },\n    initialChecked = false,\n    isRequired = true,\n    \n    paypalStyle = CardConsentStyle.createDefault().apply {\n        colors = CardConsentStyle.ColorStyles(\n            backgroundColor = Color(0xFFF8F9FA),\n            textColor = Color(0xFF212529),\n            checkedColor = Color(0xFF0070BA),\n            uncheckedColor = Color(0xFF6C757D),\n            checkmarkColor = Color.White,\n            errorColor = Color(0xFFDC3545),\n            linkColor = Color(0xFF0070BA)\n        )\n        \n        textStyles = CardConsentStyle.TextStyles(\n            textStyle = TextStyle(\n                fontSize = 14.sp,\n                fontWeight = FontWeight.Normal,\n                lineHeight = 20.sp\n            ),\n            linkTextStyle = TextStyle(\n                fontSize = 14.sp,\n                fontWeight = FontWeight.Medium,\n                textDecoration = TextDecoration.Underline\n            ),\n            checkedLabelStyle = TextStyle(\n                fontSize = 14.sp,\n                fontWeight = FontWeight.SemiBold,\n                color = Color(0xFF212529)\n            ),\n            uncheckedLabelStyle = TextStyle(\n                fontSize = 14.sp,\n                fontWeight = FontWeight.Normal,\n                color = Color(0xFF6C757D)\n            ),\n            errorStyle = TextStyle(\n                fontSize = 12.sp,\n                fontWeight = FontWeight.Normal,\n                color = Color(0xFFDC3545)\n            )\n        )\n        \n        spacing = CardConsentStyle.SpacingStyles(\n            horizontalSpacing = 16f,\n            verticalSpacing = 12f,\n            errorTextPaddingStart = 40f,\n            errorTextPaddingTop = 8f\n        )\n        \n        dimensions = CardConsentStyle.DimensionStyles(\n            checkboxSize = 24f\n        )\n    },\n    \n    onToggleChanged = { isChecked ->\n        Log.d(\"Consent\", \"User consent changed: $isChecked\")\n        \n        // Track analytics\n        trackAnalyticsEvent(\"consent_changed\", mapOf(\n            \"consented\" to isChecked,\n            \"timestamp\" to System.currentTimeMillis()\n        ))\n        \n        // Update user preferences\n        updateConsentPreference(isChecked)\n        \n        // Enable/disable features based on consent\n        if (isChecked) {\n            enableVaultingFeatures()\n        } else {\n            disableVaultingFeatures()\n        }\n    },\n    \n    onLinkClick = { url ->\n        Log.d(\"Consent\", \"Legal document requested: $url\")\n        \n        // Track which document was clicked\n        val documentType = when {\n            url.contains(\"terms\") -> \"terms_of_service\"\n            url.contains(\"privacy\") -> \"privacy_policy\"\n            else -> \"unknown\"\n        }\n        \n        trackAnalyticsEvent(\"legal_document_clicked\", mapOf(\n            \"document_type\" to documentType,\n            \"url\" to url\n        ))\n        \n        // Open in custom tab or external browser\n        openLegalDocument(url)\n    },\n    \n    onTriggerFieldValidation = { result ->\n        if (!result.isValid) {\n            Log.w(\"Consent\", \"Validation failed: ${result.message}\")\n            showValidationError(\"Please agree to the terms to continue\")\n        }\n    }\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"linked-with-paypal-component","__idx":15},"children":["Linked with PayPal component"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example showing how to link consent with PayPal component:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"// Create consent component first\nval consentComponent = pxpCheckout.createComponent(\n    type = ComponentType.PAYPAL_CONSENT,\n    config = PayPalConsentConfig(\n        label = \"Save my PayPal account for faster checkout\",\n        initialChecked = false\n    )\n)\n\n// Link to PayPal component\nval paypalConfig = PayPalComponentConfig(\n    renderType = \"standalone\",\n    fundingSources = \"paypal\",\n    enableOneClickPayment = true,\n    consentComponent = consentComponent,\n    onGetConsent = {\n        consentComponent.getValue() as? Boolean ?: false\n    }\n)\n","lang":"kotlin"},"children":[]}]},"headings":[{"value":"Consent component","id":"consent-component","depth":1},{"value":"Basic usage","id":"basic-usage","depth":2},{"value":"Minimal configuration","id":"minimal-configuration","depth":3},{"value":"Advanced configuration","id":"advanced-configuration","depth":3},{"value":"Styling","id":"styling","depth":2},{"value":"Default styling","id":"default-styling","depth":3},{"value":"Custom styling","id":"custom-styling","depth":3},{"value":"Event handling","id":"event-handling","depth":2},{"value":"Methods","id":"methods","depth":2},{"value":"Content()","id":"content","depth":3},{"value":"getValue()","id":"getvalue","depth":3},{"value":"Examples","id":"examples","depth":2},{"value":"Basic consent checkbox","id":"basic-consent-checkbox","depth":3},{"value":"Consent with terms and conditions link","id":"consent-with-terms-and-conditions-link","depth":3},{"value":"Enterprise consent with custom styling","id":"enterprise-consent-with-custom-styling","depth":3},{"value":"Linked with PayPal component","id":"linked-with-paypal-component","depth":3}],"frontmatter":{"seo":{"title":"Consent component"}},"lastModified":"2026-02-26T12:14:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/android/paypal/consent-component","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}