{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["sub-heading","br","details","required","admonition"]},"type":"markdown"},"seo":{"title":"PayPal 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":"paypal-component","__idx":0},"children":["PayPal component"]},{"$$mdtype":"Tag","name":"SubHeading","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Learn about how to configure the PayPal payment button 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 component requires the following configuration to function:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val paypalConfig = PayPalComponentConfig(\n    renderType = \"standalone\",\n    fundingSources = \"paypal\",\n    shippingPreference = \"NoShipping\",\n    userAction = \"PayNow\"\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":["renderType"]},{"$$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 type of button to render. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["standalone"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["standalone"]},": A single button"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setOfButtons"]},": Multiple buttons for different funding sources"]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fundingSources"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Any?"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The payment method(s) to support. The type depends on the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["renderType"]},": String for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["standalone"]}," (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypal"]},"), List<String> for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setOfButtons"]}," (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["listOf(\"paypal\", \"paylater\")"]},").",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypal"]},": Standard PayPal payments"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paylater"]},": PayPal Pay Later financing"]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shippingPreference"]},{"$$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 shipping details to use. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NoShipping"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NoShipping"]},": No shipping address required"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GetFromFile"]},": Get the shipping address from the PayPal account"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SetProvidedAddress"]},": Use the provided shipping address"]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userAction"]},{"$$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 next step in the payment flow. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayNow"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayNow"]},": Immediate payment capture"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Continue"]},": Continue to PayPal for payment"]}]}]}]}]}]}]},{"$$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 and features:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val paypalConfig = PayPalComponentConfig(\n    // Required configuration\n    renderType = \"standalone\",\n    fundingSources = \"paypal\",\n    shippingPreference = \"NoShipping\",\n    userAction = \"PayNow\",\n    \n    // Payment details\n    payeeEmailAddress = \"merchant@example.com\",\n    paymentDescription = \"Premium subscription\",\n    \n    // Shipping configuration\n    shippingOptions = listOf(\n        ShippingOption(\n            id = \"1\",\n            label = \"Standard Shipping\",\n            selected = true,\n            amounts = ShippingAmounts(\n                currencyCode = \"USD\",\n                shipping = 5.99\n            )\n        )\n    ),\n    \n    // One-click payment configuration\n    enableOneClickPayment = true,\n    scriptParams = PayPalScriptParams(\n        userIdToken = \"YOUR_USER_ID_TOKEN\"\n    ),\n    \n    // Component linking\n    toggleComponent = toggleComponent,\n    consentComponent = consentComponent,\n    \n    // Localisation\n    locale = \"en-US\",\n    \n    // Query parameters\n    queryParams = PayPalQueryParams(\n        buyerCountry = \"US\",\n        debug = false,\n        integrationDate = \"2025-07-01\"\n    ),\n    \n    // Layout configuration\n    componentLayoutConfig = PayPalComponentLayoutConfig(\n        minHeightPercent = 0.1f,\n        maxHeightPercent = 0.6f\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":["payeeEmailAddress"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Your email address. Defaults to empty string."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paymentDescription"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A description of the payment. Defaults to empty string."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shippingOptions"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["List<ShippingOption>?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Details about the shipping options. Provide this only when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shippingPreference"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GetFromFile"]},". 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":["enableOneClickPayment"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Whether to enable one-click payment with vaulting. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scriptParams"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayPalScriptParams?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Optional script parameters including ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userIdToken"]}," for one-click payments. 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":["scriptParams.userIdToken"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Your user ID token. Required for one-click payment functionality. 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":["toggleComponent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["ToggleComponent?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Toggle component for payment method switching. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]},". See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/android/paypal/toggle-component"},"children":["Toggle component"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["consentComponent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayPalConsentComponent?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Consent component for vaulting agreement. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]},". See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/android/paypal/consent-component"},"children":["Consent component"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["locale"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The language and region for PayPal interface (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["en-US"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fr-FR"]},"). Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["en-US"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["queryParams"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayPalQueryParams?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Advanced SDK initialisation parameters. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]},". See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/android/paypal/query-script-parameters"},"children":["Query and script parameters"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["queryParams.buyerCountry"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The buyer's country code in ISO-3166-1 alpha-2 format. 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":["queryParams.debug"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Whether to use debug mode. 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":["queryParams.integrationDate"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The date when your PayPal client ID was created (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["YYYY-MM-DD"]},"). 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":["componentLayoutConfig"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayPalComponentLayoutConfig"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Controls WebView height constraints. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayPalComponentLayoutConfig()"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentLayoutConfig.minHeightPercent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Float"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Minimum WebView height as screen percentage. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0.1f"]}," (10%)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentLayoutConfig.maxHeightPercent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Float"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Maximum WebView height as screen percentage. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0.6f"]}," (60%)."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["enableOneClickPayment"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", you must provide a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userIdToken"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scriptParams"]},". This token is obtained from checking the vault status for your merchant shopper ID."]}]},{"$$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 component renders with these default styles:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"style = PayPalButtonStyle(\n    layout = \"vertical\",\n    color = \"gold\",\n    shape = \"rect\",\n    label = \"paypal\",\n    tagline = false,\n    height = 55,\n    borderRadius = 4,\n    disableMaxWidth = false\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can find PayPal's official rules around button styling in their ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developer.paypal.com/sdk/js/reference/#buttons"},"children":["JavaScript SDK reference"]},"."]}]},{"$$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:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val paypalConfig = PayPalComponentConfig(\n    style = PayPalButtonStyle(\n        layout = \"horizontal\",\n        color = \"blue\",\n        shape = \"pill\",\n        label = \"buynow\",\n        tagline = true,\n        height = 48,\n        borderRadius = 8,\n        disableMaxHeight = false,\n        disableMaxWidth = true\n    ),\n    message = PayPalMessage(\n        amount = 99.99,\n        align = \"center\",\n        color = \"black\",\n        position = \"bottom\"\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":["style"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayPalButtonStyle?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Styling options for the PayPal button. 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":["style.layout"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The layout of the PayPal button. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["vertical"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["vertical"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["horizontal"]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["style.color"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The colour of the PayPal button. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["gold"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["gold"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["blue"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["silver"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["white"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["black"]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["style.shape"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The shape of the PayPal button. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rect"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rect"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pill"]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":["If ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["borderRadius"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shape"]}," are both defined, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["borderRadius"]}," takes priority."]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["style.borderRadius"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Int?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The border radius of the PayPal button, in pixels. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]},".",{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":["If ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["borderRadius"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shape"]}," are both defined, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["borderRadius"]}," takes priority."]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["style.height"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Int?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The height of the PayPal button, in pixels. Must be between 25-55px. 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":["style.disableMaxHeight"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Whether to disable the maximum height constraint of the PayPal button. 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":["style.disableMaxWidth"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Whether to disable the maximum width constraint of the PayPal button. 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":["style.label"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The label text of the PayPal button. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypal"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypal"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkout"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["buynow"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pay"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["installment"]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["style.tagline"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Whether to show the tagline of the PayPal button. Set the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["layout"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["horizontal"]}," for taglines. 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":["message"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayPalMessage?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Configuration for the messaging for the most relevant Pay Later offer. If provided, replaces the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tagline"]},". 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":["message.amount"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Double"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Use this option to show the most relevant offer and price breakdown. Set this to a number greater than ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]},". Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0.0"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message.align"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The alignment of the message, in relation to the button(s). Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["center"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["center"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["left"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["right"]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message.color"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The colour of the message. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["black"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["black"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["white"]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message.position"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The position of the message, in relation to the button(s). Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["top"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["top"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bottom"]}]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"event-handling","__idx":7},"children":["Event handling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The PayPal component provides event handlers to manage the complete payment flow:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val paypalConfig = PayPalComponentConfig(\n    onSuccess = { data: String -> },\n    onError = { error: String -> },\n    onCancel = { -> },\n    onShippingAddressChange = { data: String -> String? },\n    onShippingOptionsChange = { data: String -> String? },\n    onOrderCreated = { orderData: String -> },\n    onSubmitError = { error: String -> },\n    onScriptLoaded = { -> },\n    onGetConsent = { -> Boolean }\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":["onSuccess: ((String) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when the PayPal payment succeeds with payment approval data. The string parameter contains JSON with order details including ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["orderID"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["payerID"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paymentID"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError: ((String) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when the PayPal payment encounters an error. The string parameter contains the error message."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCancel: (() -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when the user cancels the PayPal payment flow. No parameters."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onShippingAddressChange: ((String) -> String?)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when the shipping address changes in the PayPal checkout. Receive address data and return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," to accept or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reject:ERROR_CODE"]}," to reject."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onShippingOptionsChange: ((String) -> String?)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when the shipping options change in the PayPal checkout. Receive option data and return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," to accept or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reject:ERROR_CODE"]}," to reject."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onOrderCreated: ((String) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when the PayPal order is successfully created. The string parameter contains the order ID."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError: ((String) -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when the order creation or submission fails. The string parameter contains the error details."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onScriptLoaded: (() -> Unit)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler for when the PayPal SDK script loads successfully. Useful for hiding loading indicators."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetConsent: (() -> Boolean)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event handler to get user consent for vaulting PayPal account. Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," if user consents, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," otherwise."]}]}]}]}]},{"$$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 component provides methods for lifecycle management."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"content","__idx":9},"children":["Content()"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Renders the PayPal button in Jetpack Compose:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"@Composable\nfun PaymentScreen() {\n    val paypalComponent = remember {\n        pxpCheckout.createComponent(\n            type = ComponentType.PAYPAL,\n            config = paypalConfig\n        )\n    }\n    \n    pxpCheckout.buildComponentView(\n        component = paypalComponent,\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 component state:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val componentValue = paypalComponent.getValue()\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-payment-button","__idx":12},"children":["Basic payment button"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A straightforward implementation with essential configuration and error handling:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val paypalConfig = PayPalComponentConfig(\n    // Required configuration\n    renderType = \"standalone\",\n    fundingSources = \"paypal\",\n    shippingPreference = \"NoShipping\",\n    userAction = \"PayNow\",\n    \n    // Basic settings\n    payeeEmailAddress = \"merchant@example.com\",\n    paymentDescription = \"Order payment\",\n    enableOneClickPayment = false,\n    \n    // Essential event handlers\n    onSuccess = { data ->\n        val jsonObject = JSONObject(data)\n        val orderID = jsonObject.getString(\"orderID\")\n        Log.d(\"PayPal\", \"Payment successful: $orderID\")\n        navigateToSuccessScreen(orderID)\n    },\n    \n    onError = { error ->\n        Log.e(\"PayPal\", \"Payment failed: $error\")\n        showErrorMessage(\"Payment failed. Please try again.\")\n    },\n    \n    onCancel = {\n        Log.d(\"PayPal\", \"Payment cancelled by user\")\n        showMessage(\"Payment was cancelled.\")\n    }\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"enterprise-payment-with-full-features","__idx":13},"children":["Enterprise payment with full features"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A comprehensive implementation with one-click payments, custom styling, and complete event handling:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val paypalConfig = PayPalComponentConfig(\n    // Required configuration\n    renderType = \"standalone\",\n    fundingSources = \"paypal\",\n    shippingPreference = \"NoShipping\",\n    userAction = \"PayNow\",\n    \n    // Payment details\n    payeeEmailAddress = \"enterprise@example.com\",\n    paymentDescription = \"Enterprise subscription\",\n    \n    // One-click payment configuration\n    enableOneClickPayment = true,\n    scriptParams = PayPalScriptParams(\n        userIdToken = getUserIdToken(),\n        clientToken = getClientToken(),\n        pageType = \"checkout\"\n    ),\n    \n    // Component linking\n    toggleComponent = toggleComponent,\n    consentComponent = consentComponent,\n    \n    // Localisation\n    locale = \"en-US\",\n    \n    // Custom styling\n    style = PayPalButtonStyle(\n        layout = \"horizontal\",\n        color = \"blue\",\n        shape = \"pill\",\n        label = \"buynow\",\n        height = 48,\n        borderRadius = 8\n    ),\n    \n    // Query parameters\n    queryParams = PayPalQueryParams(\n        buyerCountry = if (BuildConfig.DEBUG) \"US\" else null,\n        debug = BuildConfig.DEBUG,\n        integrationDate = \"2025-07-01\"\n    ),\n    \n    // Layout configuration\n    componentLayoutConfig = PayPalComponentLayoutConfig(\n        minHeightPercent = 0.1f,\n        maxHeightPercent = 0.8f\n    ),\n    \n    // Complete event handling\n    onScriptLoaded = {\n        Log.d(\"PayPal\", \"SDK loaded successfully\")\n        hideLoadingIndicator()\n    },\n    \n    onOrderCreated = { orderId ->\n        Log.d(\"PayPal\", \"Order created: $orderId\")\n        trackAnalyticsEvent(\"paypal_order_created\", mapOf(\"orderId\" to orderId))\n    },\n    \n    onGetConsent = {\n        val consentGiven = consentComponent?.getValue() as? Boolean ?: false\n        Log.d(\"PayPal\", \"Consent status: $consentGiven\")\n        consentGiven\n    },\n    \n    onSuccess = { data ->\n        hideLoadingIndicator()\n        \n        val jsonObject = JSONObject(data)\n        val orderID = jsonObject.getString(\"orderID\")\n        val payerID = jsonObject.getString(\"payerID\")\n        \n        // Check if user consented to save account\n        val consentGiven = consentComponent?.getValue() as? Boolean ?: false\n        if (consentGiven) {\n            Log.d(\"PayPal\", \"User consented to save PayPal account\")\n            saveVaultingPreference(payerID)\n        }\n        \n        trackAnalyticsEvent(\"paypal_payment_success\", mapOf(\n            \"orderId\" to orderID,\n            \"vaulted\" to consentGiven\n        ))\n        \n        showPaymentSuccessMessage()\n        setTimeout({\n            navigateToSuccessScreen(orderID)\n        }, 2000)\n    },\n    \n    onError = { error ->\n        hideLoadingIndicator()\n        \n        val errorMessage = when {\n            error.contains(\"SDK\") -> \"Failed to load PayPal. Please check your connection.\"\n            error.contains(\"transaction\") -> \"Payment processing error. Please try again.\"\n            else -> \"Payment error occurred: $error\"\n        }\n        \n        Log.e(\"PayPal\", \"Payment error: $error\")\n        trackAnalyticsEvent(\"paypal_payment_error\", mapOf(\"error\" to error))\n        showErrorDialog(errorMessage)\n    },\n    \n    onCancel = {\n        Log.d(\"PayPal\", \"Payment cancelled by user\")\n        trackAnalyticsEvent(\"paypal_payment_cancelled\")\n        showMessage(\"Payment was cancelled.\")\n    },\n    \n    onSubmitError = { error ->\n        Log.e(\"PayPal\", \"Submit error: $error\")\n        showErrorDialog(\"Unable to process payment: $error\")\n    },\n    \n    onShippingAddressChange = { data ->\n        val jsonObject = JSONObject(data)\n        val address = jsonObject.optJSONObject(\"shippingAddress\")\n        val countryCode = address?.optString(\"countryCode\", \"\")\n        \n        // Validate address\n        if (countryCode != \"US\") {\n            Log.w(\"PayPal\", \"Non-US address rejected\")\n            \"reject:COUNTRY_ERROR\"\n        } else {\n            null // Accept the address\n        }\n    }\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"multiple-funding-sources","__idx":14},"children":["Multiple funding sources"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Implementation with Pay Later support:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val paypalConfig = PayPalComponentConfig(\n    // Use setOfButtons for multiple funding sources\n    renderType = \"setOfButtons\",\n    fundingSources = listOf(\"paypal\", \"paylater\"),\n    shippingPreference = \"NoShipping\",\n    userAction = \"PayNow\",\n    \n    // Payment details\n    payeeEmailAddress = \"merchant@example.com\",\n    paymentDescription = \"Product purchase\",\n    \n    // Custom styling for multiple buttons\n    style = PayPalButtonStyle(\n        layout = \"vertical\",\n        color = \"gold\",\n        shape = \"rect\",\n        height = 45\n    ),\n    \n    // Pay Later message\n    message = PayPalMessage(\n        amount = 199.99,\n        align = \"center\",\n        color = \"black\",\n        position = \"bottom\"\n    ),\n    \n    onSuccess = { data ->\n        val jsonObject = JSONObject(data)\n        val orderID = jsonObject.getString(\"orderID\")\n        val paymentSource = jsonObject.optString(\"paymentSource\", \"paypal\")\n        \n        Log.d(\"PayPal\", \"Payment via $paymentSource: $orderID\")\n        navigateToSuccessScreen(orderID)\n    }\n)\n","lang":"kotlin"},"children":[]}]},"headings":[{"value":"PayPal component","id":"paypal-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 payment button","id":"basic-payment-button","depth":3},{"value":"Enterprise payment with full features","id":"enterprise-payment-with-full-features","depth":3},{"value":"Multiple funding sources","id":"multiple-funding-sources","depth":3}],"frontmatter":{"seo":{"title":"PayPal component"}},"lastModified":"2026-02-26T12:14:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/android/paypal/paypal-component","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}