{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["br","details","required","admonition"]},"type":"markdown"},"seo":{"title":"Events","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":"events","__idx":0},"children":["Events"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview","__idx":1},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Google Pay button component emits events based on user interaction and payment processing stages. You can implement callback functions to inject your own business logic and customise the user experience at critical moments throughout the payment flow. While the SDK handles the complex technical aspects of payment processing, you retain full control over the customer experience and can seamlessly integrate payments into your broader business workflows."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Callbacks enable you to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate business rules before payments proceed."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Display custom error, failure, or success messages."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Integrate with fraud detection systems."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Control the payment flow based on transaction data."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Handle 3D Secure authentication."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Collect and validate additional security data (CVC)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Manage consent for payment tokens and recurring payments."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track analytics and monitor payment performance."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Implement retry logic for soft declines."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"payment-flow-events","__idx":2},"children":["Payment flow events"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpreauthorisation","__idx":3},"children":["onPreAuthorisation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered before payment authorisation, allowing you to provide transaction initialisation data or control whether to proceed."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Integrate with Kount or other fraud detection services."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Apply business rules based on transaction amount or customer history."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check product availability before processing payment."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Provide risk screening data for fraud prevention."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Configure PSD2 SCA exemptions for the transaction."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Cancel the payment if business rules aren't met."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature","__idx":4},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPreAuthorisation: (suspend (PreAuthorisationData?) -> GooglePayTransactionInitData?)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data","__idx":5},"children":["Event data"]},{"$$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":"Parameter"},"children":["Parameter"]},{"$$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":["data"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PreAuthorisationData?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Pre-authorisation data containing token identifiers."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.gatewayTokenId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The gateway token identifier for the payment. Use this ID to retrieve full token details from the Unity backend."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.schemeTokenId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The scheme token identifier for the payment (e.g., Visa Token Service, Mastercard Digital Enablement Service)."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value","__idx":6},"children":["Return value"]},{"$$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":"Return type"},"children":["Return type"]},{"$$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":["GooglePayTransactionInitData"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Transaction initialisation data to proceed with payment."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayTransactionInitData.psd2Data"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["PSD2 data including SCA exemption configuration."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayTransactionInitData.psd2Data.scaExemption"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SCA exemption type: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ANONYMOUS_CARD"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["LOW_VALUE"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SECURE_CORPORATE"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TRANSACTION_RISK_ANALYSIS"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TRUSTED_BENEFICIARY"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayTransactionInitData.riskScreeningData"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Risk screening data for fraud detection (Kount)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayTransactionInitData.riskScreeningData.performRiskScreening"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether to perform risk screening (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Boolean"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayTransactionInitData.riskScreeningData.excludeDeviceData"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether to exclude device data from risk screening (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Boolean"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Return null to cancel the authorisation."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation","__idx":7},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"import com.pxp.checkout.components.googlepay.types.GooglePayTransactionInitData\nimport com.pxp.checkout.services.kount.*\nimport com.pxp.checkout.services.models.transaction.ScaExemptionType\n\nval googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onPreAuthorisation = suspend { data ->\n        Log.d(\"GooglePay\", \"Pre-authorisation started\")\n        Log.d(\"GooglePay\", \"Gateway Token ID: ${data?.gatewayTokenId}\")\n        Log.d(\"GooglePay\", \"Scheme Token ID: ${data?.schemeTokenId}\")\n        \n        // Perform pre-payment validation\n        val isHighRisk = checkCustomerRiskProfile()\n        val customerTier = getCustomerTier()\n        \n        // Check inventory before proceeding\n        val inventoryAvailable = checkInventoryAvailability()\n        if (!inventoryAvailable) {\n            showError(\"Some items are no longer available\")\n            return@suspend null // Cancel payment\n        }\n        \n        // Check business rules\n        val cartTotal = getCurrentCartTotal()\n        if (cartTotal > 10000.0 && isHighRisk) {\n            showError(\"Transaction requires additional verification\")\n            return@suspend null // Cancel payment for manual review\n        }\n        \n        GooglePayTransactionInitData(\n            riskScreeningData = RiskScreeningData(\n                performRiskScreening = true,\n                excludeDeviceData = false,\n                userIp = \"192.168.1.100\",\n                account = RiskScreeningAccount(\n                    id = \"user_12345678\",\n                    creationDateTime = \"2024-01-15T10:30:00.000Z\"\n                ),\n                transaction = RiskScreeningTransaction(\n                    subtotal = cartTotal\n                ),\n                items = cartItems.map { item ->\n                    RiskScreeningItem(\n                        price = item.price,\n                        quantity = item.quantity,\n                        category = item.category,\n                        sku = item.sku\n                    )\n                },\n                fulfillments = listOf(\n                    RiskScreeningFulfillment(\n                        type = FulfillmentType.SHIPPED,\n                        shipping = RiskScreeningShipping(\n                            shippingMethod = ShippingMethod.STANDARD\n                        ),\n                        recipientPerson = RiskScreeningRecipientPerson(\n                            phoneNumber = \"+1234567890\"\n                        )\n                    )\n                )\n            ),\n            psd2Data = GooglePayTransactionInitData.Psd2Data(\n                scaExemption = if (cartTotal < 30.0) {\n                    ScaExemptionType.LOW_VALUE\n                } else {\n                    ScaExemptionType.TRANSACTION_RISK_ANALYSIS\n                }\n            )\n        )\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpostauthorisation","__idx":8},"children":["onPostAuthorisation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after the payment is authorised, providing the transaction result and payment data."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Handle successful or declined payments."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navigate to success or failure screens."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Update inventory and order status."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send order confirmation emails."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Record transactions for business intelligence."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Display custom success or error messages."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Process shipping information collected from Google Pay."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Save transaction details for customer account history."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Update UI based on payment outcome."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-1","__idx":9},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPostAuthorisation: ((SubmitResult?, AuthorisationPaymentData) -> Unit)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-1","__idx":10},"children":["Event data"]},{"$$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":"Parameter"},"children":["Parameter"]},{"$$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":["result"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["SubmitResult?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The transaction result: either ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MerchantSubmitResult"]}," (success) or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]}," (failure)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.merchantTransactionId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your unique transaction identifier (present in both success and failure)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.systemTransactionId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["PXP system transaction identifier (only in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MerchantSubmitResult"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.errorCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Error code (only in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.errorReason"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Error description (only in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.correlationId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Correlation ID for tracking (only in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.httpStatusCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Int"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["HTTP status code (only in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paymentData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["AuthorisationPaymentData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Google Pay payment data collected during checkout."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paymentData.email"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Customer email address (if email collection was enabled)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paymentData.shippingAddress"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Map<String, String?>?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Shipping address (if shipping address collection was enabled)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paymentData.shippingOption"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Map<String, String?>?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Selected shipping option (if shipping options were provided)."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-1","__idx":11},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onPostAuthorisation = { result, paymentData ->\n        Log.d(\"GooglePay\", \"Payment completed: $result\")\n        \n        when (result) {\n            is MerchantSubmitResult -> {\n                // Payment successful\n                Log.d(\"GooglePay\", \"Payment authorised successfully\")\n                Log.d(\"GooglePay\", \"Merchant Transaction ID: ${result.merchantTransactionId}\")\n                Log.d(\"GooglePay\", \"System Transaction ID: ${result.systemTransactionId}\")\n                \n                // Extract payment data\n                val email = paymentData.email\n                val shippingAddress = paymentData.shippingAddress\n                val shippingOption = paymentData.shippingOption\n                \n                // Use your Activity's lifecycleScope or CoroutineScope\n                lifecycleScope.launch {\n                    try {\n                        // Update inventory\n                        updateInventory(result.merchantTransactionId)\n                        \n                        // Create order record\n                        createOrder(\n                            transactionId = result.merchantTransactionId,\n                            systemTransactionId = result.systemTransactionId,\n                            email = email,\n                            shippingAddress = shippingAddress,\n                            shippingMethod = shippingOption?.get(\"id\"),\n                            status = \"confirmed\"\n                        )\n                        \n                        // Send confirmation email\n                        sendConfirmationEmail(\n                            transactionId = result.merchantTransactionId,\n                            email = email,\n                            shippingAddress = shippingAddress\n                        )\n                        \n                        // Track successful payment\n                        analyticsTracker.trackEvent(\"google_pay_success\") {\n                            put(\"transaction_id\", result.merchantTransactionId)\n                            put(\"cart_value\", getCurrentCartValue())\n                            put(\"shipping_method\", shippingOption?.get(\"id\"))\n                        }\n                        \n                        // Update customer account\n                        updateCustomerPurchaseHistory(result.merchantTransactionId)\n                        \n                        // Navigate to success screen\n                        withContext(Dispatchers.Main) {\n                            navController.navigate(\n                                \"payment_success/${result.merchantTransactionId}\"\n                            )\n                        }\n                    } catch (e: Exception) {\n                        Log.e(\"GooglePay\", \"Error in post-authorisation\", e)\n                        showError(\"Payment succeeded but order processing failed\")\n                    }\n                }\n            }\n            \n            is FailedSubmitResult -> {\n                // Payment declined\n                Log.e(\"GooglePay\", \"Payment declined: ${result.errorReason}\")\n                Log.e(\"GooglePay\", \"Error code: ${result.errorCode}\")\n                Log.e(\"GooglePay\", \"Correlation ID: ${result.correlationId}\")\n                \n                // Log failure for monitoring\n                logPaymentFailure(\n                    errorCode = result.errorCode,\n                    errorReason = result.errorReason,\n                    correlationId = result.correlationId,\n                    merchantTransactionId = result.merchantTransactionId\n                )\n                \n                // Show user-friendly error message\n                val errorMessage = getErrorMessage(result.errorCode)\n                showError(\"Payment declined: $errorMessage\")\n                \n                // Track failed payment\n                analyticsTracker.trackEvent(\"google_pay_declined\") {\n                    put(\"error_code\", result.errorCode)\n                    put(\"correlation_id\", result.correlationId)\n                }\n                \n                // Offer alternatives\n                showAlternativePaymentMethods()\n            }\n            \n            else -> {\n                // Unexpected result\n                Log.e(\"GooglePay\", \"Unexpected result: $result\")\n                showError(\"Payment processing error. Please contact support.\")\n                analyticsTracker.trackEvent(\"google_pay_exception\") {\n                    put(\"result\", result.toString())\n                }\n            }\n        }\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"google-pay-sheet-interaction-events","__idx":12},"children":["Google Pay sheet interaction events"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpaymentdatachanged","__idx":13},"children":["onPaymentDataChanged"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when payment data changes in the Google Pay sheet, such as shipping address or shipping option selection."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Calculate shipping costs based on selected address."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Update transaction amounts dynamically."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate addresses and show errors for unserviceable locations."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Add or remove line items based on selections."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Calculate taxes based on shipping destination."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Apply discounts based on shipping method selection."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check delivery availability for specific locations."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When updating transaction amounts, use the SDK's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["updateAmount()"]}," method to synchronise the amount with the backend session."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-2","__idx":14},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPaymentDataChanged: ((Any) -> Any?)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-2","__idx":15},"children":["Event data"]},{"$$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":"Parameter"},"children":["Parameter"]},{"$$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":["intermediatePaymentData"]},{"$$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":{},"children":["Google Pay intermediate payment data containing shipping address and option selections. This is a dynamic object from the Google Pay API that you'll need to parse based on Google Pay's structure."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["intermediatePaymentData"]}," object contains fields like ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["callbackTrigger"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shippingAddress"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shippingOptionData"]}," that follow Google Pay's API structure. You'll need to cast and parse this ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Any"]}," object to access these properties."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value-1","__idx":16},"children":["Return value"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return a Map structure representing updated payment data to display in the Google Pay sheet. The structure should follow Google Pay's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentDataRequestUpdate"]}," format with the following fields:"]},{"$$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":"Return field"},"children":["Return field"]},{"$$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":["newTransactionInfo"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Map containing updated transaction information."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["newTransactionInfo.totalPrice"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Updated total price as a string."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["newTransactionInfo.totalPriceStatus"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Price status: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"FINAL\""]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"ESTIMATED\""]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["newTransactionInfo.displayItems"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["List of Maps representing line items with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["label"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["type"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["price"]}," fields."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["newShippingOptionParameters"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Map containing updated shipping options (optional)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Map containing error information for invalid addresses or options (optional)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.reason"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Error reason: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"SHIPPING_ADDRESS_INVALID\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"SHIPPING_ADDRESS_UNSERVICEABLE\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"SHIPPING_OPTION_INVALID\""]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.message"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["User-friendly error message."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.intent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The callback intent that triggered the error: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"SHIPPING_ADDRESS\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"SHIPPING_OPTION\""]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-2","__idx":17},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    paymentDataRequest = PaymentDataRequest(\n        // ... other configuration\n        shippingAddressRequired = true,\n        shippingOptionRequired = true\n    )\n    \n    onPaymentDataChanged = { intermediatePaymentData ->\n        Log.d(\"GooglePay\", \"Payment data changed\")\n        \n        // Parse the intermediate payment data\n        // Note: You'll need to cast/parse based on Google Pay's structure\n        \n        val baseAmount = 20.00\n        var tax = 5.00\n        var shippingCost = 0.0\n        var errorMap: Map<String, String>? = null\n        \n        // Example: Handle shipping address or option changes\n        // The structure depends on Google Pay's IntermediatePaymentData format\n        \n        // Calculate new total\n        val newTotal = baseAmount + tax + shippingCost\n        \n        // Update SDK amount\n        pxpCheckout.updateAmount(newTotal)\n        \n        // Return updated payment data as Map\n        mapOf(\n            \"newTransactionInfo\" to mapOf(\n                \"totalPrice\" to newTotal.toString(),\n                \"totalPriceStatus\" to \"FINAL\",\n                \"displayItems\" to listOf(\n                    mapOf(\n                        \"label\" to \"Subtotal\",\n                        \"type\" to \"SUBTOTAL\",\n                        \"price\" to baseAmount.toString()\n                    ),\n                    mapOf(\n                        \"label\" to \"Shipping\",\n                        \"type\" to \"LINE_ITEM\",\n                        \"price\" to shippingCost.toString()\n                    ),\n                    mapOf(\n                        \"label\" to \"Tax\",\n                        \"type\" to \"TAX\",\n                        \"price\" to tax.toString()\n                    )\n                )\n            ),\n            \"error\" to errorMap // Include error if validation failed\n        ).filterValues { it != null } // Remove null values\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ongooglepaymentbuttonclicked","__idx":18},"children":["onGooglePaymentButtonClicked"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when the Google Pay button is tapped, before the payment sheet opens."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track button click events for analytics."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Show loading indicators or progress dialogs."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Perform final validation before opening payment sheet."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Update cart totals or recalculate amounts."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check inventory availability one last time."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Prepare data for the payment flow."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-3","__idx":19},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onGooglePaymentButtonClicked: (() -> kotlinx.coroutines.Deferred<Unit>?)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-3","__idx":20},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-3","__idx":21},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onGooglePaymentButtonClicked = {\n        Log.d(\"GooglePay\", \"Google Pay button clicked\")\n        \n        // Track button click\n        analyticsTracker.trackEvent(\"google_pay_button_clicked\") {\n            put(\"timestamp\", System.currentTimeMillis())\n            put(\"cart_value\", getCurrentCartValue())\n            put(\"item_count\", getCartItemCount())\n        }\n        \n        // Show loading indicator\n        withContext(Dispatchers.Main) {\n            showLoadingDialog()\n        }\n        \n        // Final inventory check\n        val inventoryOk = checkInventoryAvailability()\n        if (!inventoryOk) {\n            withContext(Dispatchers.Main) {\n                hideLoadingDialog()\n                showError(\"Some items are no longer available\")\n            }\n            throw IllegalStateException(\"Inventory unavailable\")\n        }\n        \n        // Prepare checkout data\n        prepareCheckoutData()\n        \n        // Update cart totals\n        recalculateCartTotals()\n        \n        withContext(Dispatchers.Main) {\n            hideLoadingDialog()\n        }\n        \n        CompletableDeferred(Unit)\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"validation-and-error-events","__idx":22},"children":["Validation and error events"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"oncustomvalidation","__idx":23},"children":["onCustomValidation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is executed before opening the Google Pay payment sheet, allowing custom validation of other form fields."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate required form fields before payment."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check terms and conditions acceptance."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify customer information completeness."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Prevent payment sheet from opening if validation fails."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate minimum order amounts."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check age verification requirements."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-4","__idx":24},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onCustomValidation: (() -> suspend Boolean)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-4","__idx":25},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value-2","__idx":26},"children":["Return value"]},{"$$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":"Return value"},"children":["Return value"]},{"$$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":["Boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," to proceed with opening payment sheet, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," to prevent opening."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-4","__idx":27},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onCustomValidation = suspend {\n        var isValid = true\n        \n        // Validate email\n        val email = emailField.text.toString()\n        if (email.isEmpty() || !email.contains('@')) {\n            showError(\"Please enter a valid email address\")\n            highlightField(emailField)\n            isValid = false\n        }\n        \n        // Validate phone number (if required)\n        val phone = phoneField.text.toString()\n        if (phone.isEmpty() || phone.length < 10) {\n            showError(\"Please enter a valid phone number\")\n            highlightField(phoneField)\n            isValid = false\n        }\n        \n        // Validate terms acceptance\n        val termsAccepted = termsCheckbox.isChecked\n        if (!termsAccepted) {\n            showError(\"Please accept the terms and conditions\")\n            highlightField(termsCheckbox)\n            isValid = false\n        }\n        \n        // Validate age verification (if required)\n        val ageVerified = ageVerifyCheckbox.isChecked\n        if (!ageVerified) {\n            showError(\"You must be 18 or older to complete this purchase\")\n            isValid = false\n        }\n        \n        // Validate minimum order amount\n        val cartTotal = getCurrentCartTotal()\n        if (cartTotal < 10.00) {\n            showError(\"Minimum order amount is £10.00\")\n            isValid = false\n        }\n        \n        // Final inventory check\n        if (isValid) {\n            val inventoryAvailable = checkInventory()\n            if (!inventoryAvailable) {\n                showError(\"Some items are no longer available. Please review your cart.\")\n                isValid = false\n            }\n        }\n        \n        isValid // Return validation result\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onerror","__idx":28},"children":["onError"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when an error occurs during the Google Pay payment process."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log errors for debugging and monitoring."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Display user-friendly error messages."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Offer alternative payment methods."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Implement automatic retry for transient errors."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send error notifications to support teams."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track error rates for quality monitoring."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-5","__idx":29},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onError: ((BaseSdkException) -> Unit)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-5","__idx":30},"children":["Event data"]},{"$$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":"Event data"},"children":["Event data"]},{"$$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":["error"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["BaseSdkException"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The SDK exception containing error details."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.message"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A human-readable error description."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.ErrorCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The error code for programmatic handling."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.cause"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Throwable?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The underlying cause of the error, if available."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"exception-types","__idx":31},"children":["Exception types"]},{"$$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":"Exception"},"children":["Exception"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Code"},"children":["Code"]},{"$$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":["GooglePayNotReadyException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SDK0701"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Google Pay not available on device."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayPaymentFailedException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SDK0702"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Payment processing failed."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayClientNotInitializedException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SDK0703"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Client not properly initialised."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayLoadFailedException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SDK0704"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Failed to load Google Pay API."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayConfigurationValidationFailedException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SDK0705"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Invalid configuration."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayDecryptAndTokenVaultFailedException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SDK0706"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Token processing failed."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UnsupportedFundingTypeGooglePaySdkException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["SDK0110"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Google Pay not in allowed funding types."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-5","__idx":32},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onError = { error ->\n        Log.e(\"GooglePay\", \"Error occurred\", error)\n        \n        // Log error for debugging\n        logError(\"google-pay-error\") {\n            put(\"message\", error.message ?: \"Unknown error\")\n            put(\"code\", error.ErrorCode)\n            put(\"timestamp\", System.currentTimeMillis())\n            put(\"user_id\", getCurrentUserId())\n        }\n        \n        // Handle specific error types\n        when (error) {\n            is GooglePayNotReadyException -> {\n                Log.e(\"GooglePay\", \"Google Pay not available\")\n                showError(\"Google Pay is not available on this device. Please use another payment method.\")\n                showAlternativePaymentMethods()\n                analyticsTracker.trackEvent(\"google_pay_not_available\")\n            }\n            \n            is GooglePayConfigurationValidationFailedException -> {\n                Log.e(\"GooglePay\", \"Configuration validation failed\")\n                showError(\"Payment system temporarily unavailable. Please try again later.\")\n                notifySupport(\"Configuration error\", error)\n            }\n            \n            is GooglePayClientNotInitializedException -> {\n                Log.e(\"GooglePay\", \"Client not initialised\")\n                showError(\"Payment system not ready. Please refresh and try again.\")\n                notifySupport(\"Client initialisation error\", error)\n            }\n            \n            is GooglePayLoadFailedException -> {\n                Log.e(\"GooglePay\", \"Failed to load Google Pay\")\n                showError(\"Unable to load payment system. Please check your connection.\")\n                offerRetryOption()\n            }\n            \n            is GooglePayPaymentFailedException -> {\n                Log.e(\"GooglePay\", \"Payment processing failed\")\n                showError(\"Payment failed. Please check your payment information.\")\n                offerRetryOption()\n            }\n            \n            is GooglePayDecryptAndTokenVaultFailedException -> {\n                Log.e(\"GooglePay\", \"Token vault error\")\n                showError(\"Payment processing error. Please try again.\")\n                notifySupport(\"Token vault error\", error)\n            }\n            \n            else -> {\n                Log.e(\"GooglePay\", \"Unexpected error: ${error.message}\")\n                showError(\"An unexpected error occurred. Please try again.\")\n                analyticsTracker.trackEvent(\"google_pay_error\") {\n                    put(\"error_type\", error::class.simpleName ?: \"Unknown\")\n                    put(\"error_code\", error.ErrorCode)\n                }\n            }\n        }\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"oncancel","__idx":33},"children":["onCancel"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when the customer cancels the Google Pay payment flow."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track cancellation rates for conversion optimisation."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Show helpful messages or alternative options."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Save the customer's cart for later completion."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Trigger abandoned cart workflows."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Understand drop-off points in the payment flow."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Offer assistance or support."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-6","__idx":34},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onCancel: (() -> Unit)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-6","__idx":35},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-6","__idx":36},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onCancel = {\n        Log.d(\"GooglePay\", \"Payment cancelled by user\")\n        \n        // Track cancellation\n        analyticsTracker.trackEvent(\"google_pay_cancelled\") {\n            put(\"timestamp\", System.currentTimeMillis())\n            put(\"cart_value\", getCurrentCartValue())\n            put(\"item_count\", getCartItemCount())\n        }\n        \n        // Preserve cart for later\n        saveCartForLater()\n        \n        // Show helpful message\n        showMessage(\n            \"No worries! Your items are saved. You can complete your purchase anytime.\",\n            isError = false\n        )\n        \n        // Offer support for high-value carts\n        if (getCartValue() > 100.0) {\n            showSupportDialog(\"Need help completing your purchase?\")\n        }\n        \n        // Schedule abandoned cart notification\n        lifecycleScope.launch {\n            scheduleAbandonedCartNotification(\n                customerId = getCurrentCustomerId(),\n                cartData = getCurrentCartData(),\n                delayMinutes = 60\n            )\n        }\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"3d-secure-authentication-events","__idx":37},"children":["3D Secure authentication events"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"useunityauthenticationstrategy","__idx":38},"children":["useUnityAuthenticationStrategy"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This configuration parameter controls which authentication strategy is used for 3DS authentication."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"configuration","__idx":39},"children":["Configuration"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"useUnityAuthenticationStrategy: Boolean = false\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", uses Unity's automatic authentication strategy. When ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," or not specified, uses manual authentication callbacks."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-7","__idx":40},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    // Enable Unity authentication strategy\n    useUnityAuthenticationStrategy = true\n    \n    // Simplified callbacks when using Unity strategy\n    onPreInitiateAuthentication = {\n        PreInitiateIntegratedAuthenticationData(\n            providerId = \"pxpfinancial\",\n            timeout = 12\n        )\n    }\n    \n    onPreAuthentication = suspend {\n        InitiateIntegratedAuthenticationData(\n            merchantCountryNumericCode = \"840\",\n            merchantLegalName = \"Your Store Name\",\n            challengeWindowSize = ChallengeWindowSize.FULL_SCREEN,\n            requestorChallengeIndicator = RequestorChallengeIndicatorType.NO_PREFERENCE,\n            timeout = 180\n        )\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpreinitiateauthentication","__idx":41},"children":["onPreInitiateAuthentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered before initiating the 3DS pre-authentication check."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Configure 3DS provider settings."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Set authentication request preferences."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Specify timeout values for authentication requests."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Control the initial authentication flow."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-7","__idx":42},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPreInitiateAuthentication: (() -> PreInitiateIntegratedAuthenticationData?)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-7","__idx":43},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value-3","__idx":44},"children":["Return value"]},{"$$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":"Return value"},"children":["Return value"]},{"$$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":["PreInitiateIntegratedAuthenticationData"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Configuration for 3DS pre-authentication."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PreInitiateIntegratedAuthenticationData.providerId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your 3DS provider identifier. Optional."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PreInitiateIntegratedAuthenticationData.requestorAuthenticationIndicator"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The authentication indicator. Optional.",{"$$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":["PAYMENT_TRANSACTION"]}," (01)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RECURRING_TRANSACTION"]}," (02)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["INSTALLMENT_TRANSACTION"]}," (03)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ADD_CARD"]}," (04)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MAINTAIN_CARD"]}," (05)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CARD_HOLDER_VERIFICATION"]}," (06)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BILLING_AGREEMENT"]}," (07)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DEVICE_BINDING"]}," (08)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SPLIT_DELAYED_SHIPMENT"]}," (09)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TOP_UP"]}," (10)"]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PreInitiateIntegratedAuthenticationData.timeout"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The timeout to get the fingerprint result, in seconds (max 600). Optional."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Return null to skip 3DS authentication."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-8","__idx":45},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"import com.pxp.checkout.services.models.authentication.PreInitiateIntegratedAuthenticationData\nimport com.pxp.checkout.models.RequestorAuthenticationIndicatorType\n\nval googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onPreInitiateAuthentication = {\n        Log.d(\"GooglePay\", \"Initiating 3DS pre-authentication\")\n        \n        // Track 3DS initiation\n        analyticsTracker.trackEvent(\"3ds_pre_initiate\")\n        \n        PreInitiateIntegratedAuthenticationData(\n            providerId = \"your-3ds-provider-id\", // Optional\n            requestorAuthenticationIndicator = RequestorAuthenticationIndicatorType.PAYMENT_TRANSACTION,\n            timeout = 300 // 5 minutes\n        )\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpostinitiateauthentication","__idx":46},"children":["onPostInitiateAuthentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after the 3DS pre-authentication check completes."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Read ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authenticationId"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["threeDSecureSupported"]}," from the success result."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Retrieve authentication assessment results from your backend using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authenticationId"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Determine if full authentication is required."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log authentication initiation for compliance."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check SCA requirements and exemptions."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Decide whether to proceed with challenge."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-8","__idx":47},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPostInitiateAuthentication: ((AuthenticationResult) -> Unit)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-8","__idx":48},"children":["Event data"]},{"$$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":"Parameter"},"children":["Parameter"]},{"$$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":["result"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["AuthenticationResult"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Authentication initiation result. Success is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MerchantAuthenticationResult"]},"; failure is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedAuthenticationResult"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.authenticationId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unique identifier for this 3DS session. May be null when 3DS isn't required. Use this to retrieve full pre-authentication results from your backend."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.threeDSecureSupported"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether 3DS authentication is supported for this transaction."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authenticationId"]}," is absent and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["threeDSecureSupported"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},", the SDK skips the remaining 3DS flow and doesn't invoke ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthentication"]},". This early-exit check applies when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["useUnityAuthenticationStrategy"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},". When ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["useUnityAuthenticationStrategy"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", the SDK uses Unity's authentication strategy API instead. Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authenticationId"]}," with the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/three-d-secure-authentication/integrated-authentication/get-preinitiate-authentication-details"},"children":["Get 3DS pre-initiate authentication details"]}," API to retrieve SCA mandates, exemptions, and state."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-9","__idx":49},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onPostInitiateAuthentication = { result ->\n        when (result) {\n            is FailedAuthenticationResult -> {\n                Log.e(\"GooglePay\", \"3DS pre-initiation failed: ${result.errorReason}\")\n            }\n            is MerchantAuthenticationResult -> {\n                Log.d(\"GooglePay\", \"Pre-authentication complete: ${result.authenticationId}\")\n                Log.d(\"GooglePay\", \"3DS supported: ${result.threeDSecureSupported}\")\n\n                if (result.authenticationId.isNullOrEmpty() && !result.threeDSecureSupported) {\n                    return@onPostInitiateAuthentication\n                }\n\n                val authId = result.authenticationId ?: return@onPostInitiateAuthentication\n\n                lifecycleScope.launch {\n                    try {\n                        val authResult = fetchAuthenticationResultFromBackend(authId)\n\n                        if (authResult.state == \"PendingClientData\") {\n                            Log.d(\"GooglePay\", \"Waiting for client data collection\")\n                        }\n\n                        if (authResult.scaMandated) {\n                            Log.d(\"GooglePay\", \"SCA is required - 3DS must complete successfully\")\n                            withContext(Dispatchers.Main) {\n                                showMessage(\"Additional verification required\")\n                            }\n                        }\n\n                        evaluateAuthenticationAndUpdateSession(authResult)\n                    } catch (e: Exception) {\n                        Log.e(\"GooglePay\", \"Error retrieving authentication result\", e)\n                    }\n                }\n            }\n        }\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpreauthentication","__idx":50},"children":["onPreAuthentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered before full 3DS authentication begins, allowing you to provide authentication configuration."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Specify merchant details for authentication."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Configure challenge window preferences."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Set challenge indicators based on risk assessment."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Provide country-specific merchant information."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Control the authentication user experience."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-9","__idx":51},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPreAuthentication: (suspend () -> InitiateIntegratedAuthenticationData?)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-9","__idx":52},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value-4","__idx":53},"children":["Return value"]},{"$$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":"Return value"},"children":["Return value"]},{"$$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":["InitiateIntegratedAuthenticationData"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Configuration for 3DS authentication."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["InitiateIntegratedAuthenticationData.merchantCountryNumericCode"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your merchant location, as an ISO numeric country code (e.g., \"840\" for USA, \"826\" for UK). Optional."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["InitiateIntegratedAuthenticationData.merchantLegalName"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your legal business name. Optional."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["InitiateIntegratedAuthenticationData.challengeWindowSize"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The challenge window size. Optional.",{"$$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":["FULL_SCREEN"]}," (01 - Fullscreen)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IFRAME_250x400"]}," (02 - 250x400 px)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IFRAME_390x400"]}," (03 - 390x400 px)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IFRAME_500x600"]}," (04 - 500x600 px)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IFRAME_600x400"]}," (05 - 600x400 px)"]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["InitiateIntegratedAuthenticationData.requestorChallengeIndicator"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The challenge preference indicator. Optional.",{"$$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":["NO_PREFERENCE"]}," (01)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NO_CHALLENGE_REQUESTED"]}," (02)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CHALLENGE_REQUESTED_3DS_REQUESTOR_PREFERENCE"]}," (03)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CHALLENGE_REQUESTED_MANDATE"]}," (04)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NO_CHALLENGE_REQUESTED_TRA_PERFORMED"]}," (05)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NO_CHALLENGE_REQUESTED_LOW_VALUE_EXEMPTION"]}," (10)"]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["InitiateIntegratedAuthenticationData.timeout"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Timeout to get the challenge result, in seconds (max 600). Optional."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["InitiateIntegratedAuthenticationData.billingAddress"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Billing address for authentication. Optional."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["InitiateIntegratedAuthenticationData.shopper"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Shopper information. Optional."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Return null to skip authentication."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-10","__idx":54},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"import com.pxp.checkout.services.models.authentication.InitiateIntegratedAuthenticationData\nimport com.pxp.checkout.models.RequestorChallengeIndicatorType\nimport com.pxp.checkout.components.threeds.ChallengeWindowSize\n\nval googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onPreAuthentication = suspend {\n        Log.d(\"GooglePay\", \"Configuring 3DS authentication\")\n        \n        // Get authentication decision from backend\n        val decision = getAuthenticationDecision()\n        \n        if (decision == null) {\n            Log.d(\"GooglePay\", \"Skipping authentication based on backend decision\")\n            return@suspend null\n        }\n        \n        // Assess transaction risk\n        val amount = getTransactionAmount()\n        val customerHistory = getCustomerHistory()\n        val isHighRisk = amount > 500.0 || customerHistory.chargebacks > 0\n        \n        // Determine challenge indicator\n        val challengeIndicator = when {\n            isHighRisk -> RequestorChallengeIndicatorType.CHALLENGE_REQUESTED_MANDATE\n            amount < 30.0 && customerHistory.successfulTransactions > 10 -> \n                RequestorChallengeIndicatorType.NO_CHALLENGE_REQUESTED\n            else -> RequestorChallengeIndicatorType.NO_PREFERENCE\n        }\n        \n        Log.d(\"GooglePay\", \"Challenge indicator: $challengeIndicator\")\n        \n        InitiateIntegratedAuthenticationData(\n            merchantCountryNumericCode = \"826\", // United Kingdom\n            merchantLegalName = \"Your Store Limited\",\n            challengeWindowSize = ChallengeWindowSize.FULL_SCREEN,\n            requestorChallengeIndicator = challengeIndicator,\n            timeout = if (decision.scaMandated) 600 else 300,\n            billingAddress = getBillingAddress()?.let {\n                BillingAddress(\n                    city = it.city,\n                    countryNumericCode = it.countryCode,\n                    line1 = it.streetAddress,\n                    postalCode = it.postalCode\n                )\n            },\n            shopper = ShopperData(\n                email = getCurrentCustomerEmail(),\n                homePhoneNumber = getCurrentCustomerPhone()\n            )\n        )\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpostauthentication","__idx":55},"children":["onPostAuthentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered after 3DS authentication completes, providing the authentication result."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Retrieve authentication results."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log authentication outcomes for compliance."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track authentication success rates."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Handle authentication failures gracefully."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Record ECI values and authentication indicators."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-10","__idx":56},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPostAuthentication: ((AuthenticationResult) -> Unit)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-10","__idx":57},"children":["Event data"]},{"$$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":"Parameter"},"children":["Parameter"]},{"$$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":["data"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["MerchantAuthenticationResult"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Authentication result containing the authentication ID."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.authenticationId"]},{"$$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":{},"children":["Unique identifier for the authentication attempt. Use this to retrieve full authentication details from your backend."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-11","__idx":58},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onPostAuthentication = { data ->\n        Log.d(\"GooglePay\", \"3DS authentication completed: ${data.authenticationId}\")\n        \n        lifecycleScope.launch {\n            try {\n                // Retrieve authentication result from backend\n                val authResult = fetchAuthenticationResultFromBackend(data.authenticationId)\n                \n                Log.d(\"GooglePay\", \"Authentication result: $authResult\")\n                \n                // Check transaction status\n                when (authResult.transactionStatus) {\n                    \"Y\" -> {\n                        Log.d(\"GooglePay\", \"Authentication successful - no challenge needed\")\n                        showMessage(\"Card verified successfully\")\n                    }\n                    \"C\" -> {\n                        if (authResult.state == \"AuthenticationSuccessful\") {\n                            Log.d(\"GooglePay\", \"Challenge completed successfully\")\n                            showMessage(\"Verification completed\")\n                        } else {\n                            Log.e(\"GooglePay\", \"Challenge failed\")\n                            showError(\"Verification failed. Please try again.\")\n                            return@launch // Stop payment\n                        }\n                    }\n                    \"N\" -> {\n                        Log.e(\"GooglePay\", \"Authentication failed\")\n                        showError(\"Card verification failed\")\n                        return@launch // Stop payment\n                    }\n                    \"R\" -> {\n                        Log.e(\"GooglePay\", \"Authentication rejected\")\n                        showError(\"Payment was rejected by your bank\")\n                        return@launch // Stop payment\n                    }\n                }\n                \n                // Evaluate and update authorisation decision\n                evaluateAuthenticationAndUpdateAuthorization(authResult)\n                \n                Log.d(\"GooglePay\", \"Proceeding to final authorisation...\")\n            } catch (e: Exception) {\n                Log.e(\"GooglePay\", \"Error processing authentication result\", e)\n                showError(\"Authentication processing error\")\n            }\n        }\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"consent-and-token-events","__idx":59},"children":["Consent and token events"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ongetconsent","__idx":60},"children":["onGetConsent"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is called to determine if the customer has given consent to store their payment token for future use."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The primary use case is to set a default consent value (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},") when you're not rendering the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["google-pay-consent"]}," checkbox component. This allows you to control token storage behaviour without requiring explicit customer interaction."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["googlePayConsentComponent"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetConsent"]}," are provided, the consent component value takes priority. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetConsent"]}," callback will not be called if a consent component is linked."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Set a default consent value when not using the consent checkbox component."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check custom consent checkbox status from your own UI."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify terms and conditions acceptance for stored payments."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Control token storage behaviour based on business logic."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Implement opt-in/opt-out for recurring payments."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Respect customer privacy preferences."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-11","__idx":61},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onGetConsent: (() -> Boolean)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-11","__idx":62},"children":["Event data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value-5","__idx":63},"children":["Return value"]},{"$$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":"Return Type"},"children":["Return Type"]},{"$$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":["Boolean"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," if consent was given, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," otherwise."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-12","__idx":64},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example 1: Set default consent value without checkbox"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    // ... payment configuration\n    \n    onGetConsent = {\n        // Return a default value when not using consent checkbox\n        // Set to true to always store tokens, false to never store\n        Log.d(\"GooglePay\", \"Setting default consent: true\")\n        true // Always save payment method for this merchant\n    }\n    \n    onPostAuthorisation = { result, paymentData ->\n        when (result) {\n            is MerchantSubmitResult -> {\n                Log.d(\"GooglePay\", \"Payment successful, token will be stored\")\n                // Token storage is handled automatically based on consent\n            }\n            else -> { /* Handle failure */ }\n        }\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example 2: Use custom consent checkbox from your UI"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    // ... payment configuration\n    \n    onGetConsent = {\n        // Check your own custom checkbox\n        val consentGiven = customConsentCheckbox.isChecked\n        \n        if (consentGiven) {\n            Log.d(\"GooglePay\", \"Customer consented to save payment method\")\n            \n            // Track consent\n            analyticsTracker.trackEvent(\"payment_consent_given\") {\n                put(\"timestamp\", System.currentTimeMillis())\n                put(\"payment_method\", \"google-pay\")\n            }\n        } else {\n            Log.d(\"GooglePay\", \"Customer did not consent to save payment method\")\n        }\n        \n        consentGiven\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example 3: With consent component (component value takes priority)"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"// Create consent component\nval consentComponent = pxpCheckout.createComponent<\n    GooglePayConsentComponent,\n    GooglePayConsentConfig\n>(\n    type = ComponentType.GOOGLE_PAY_CONSENT,\n    config = GooglePayConsentConfig(\n        label = \"Save this payment method for future purchases\",\n        initialChecked = false\n    )\n)\n\n// Create Google Pay button with consent\nval googlePayConfig = GooglePayButtonComponentConfig().apply {\n    // ... payment configuration\n    \n    // Link the consent component\n    googlePayConsentComponent = consentComponent\n    \n    // This callback will NOT be called because consent component is linked\n    onGetConsent = {\n        Log.d(\"GooglePay\", \"This callback is ignored when component is linked\")\n        true // This is ignored when consent component is present\n    }\n}\n\n// The consent component's checked state will be used for token storage\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"cvc-collection-callbacks","__idx":65},"children":["CVC collection callbacks"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Google Pay Button Component can request CVV/CVC codes for additional security. While there's no specific callback for CVC collection, you can configure the behaviour:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"cvc-collection-configuration","__idx":66},"children":["CVC collection configuration"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    // CVC collection strategy\n    collectCvc = GooglePayButtonComponentConfig.CvcCollectionStrategy.DEFAULT\n    \n    // Custom CVC dialog configuration (optional)\n    cvcVerificationPopupConfig = CvcVerificationDialogConfig(\n        title = \"Security Verification\",\n        description = \"Please enter your card's CVV code\",\n        submitButtonText = \"Confirm Payment\",\n        cancelButtonText = \"Go Back\",\n        \n        // Custom styling\n        titleStyles = TextStyle(\n            fontSize = 20.sp,\n            fontWeight = FontWeight.Bold,\n            color = Color(0xFF1A237E)\n        ),\n        \n        // CVC input configuration\n        cvcComponentConfig = CardCvcComponentConfig().apply {\n            label = \"CVV\"\n            showHintIcon = true\n            showValidIcon = true\n            showMaskToggle = true\n        }\n    )\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"cvc-collection-strategies","__idx":67},"children":["CVC collection strategies"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"enum class CvcCollectionStrategy {\n    ALWAYS,   // Always show CVC dialog for FPAN\n    NEVER,    // Never show CVC dialog\n    DEFAULT   // Show CVC only when 3DS not available/skipped\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"risk-screening-events","__idx":68},"children":["Risk screening events"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onkountcollectstart","__idx":69},"children":["onKountCollectStart"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when Kount fraud detection data collection begins."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track fraud detection start time."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Show loading indicators during fraud screening."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log fraud detection events."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Monitor fraud detection performance."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-12","__idx":70},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onKountCollectStart: ((Any) -> Unit)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-12","__idx":71},"children":["Event data"]},{"$$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":"Parameter"},"children":["Parameter"]},{"$$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":["data"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Any"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Kount collection start data."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-13","__idx":72},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onKountCollectStart = { data ->\n        Log.d(\"GooglePay\", \"Kount fraud detection started\")\n        \n        // Track fraud detection start\n        analyticsTracker.trackEvent(\"kount_collection_start\") {\n            put(\"timestamp\", System.currentTimeMillis())\n        }\n        \n        // Show fraud check indicator (optional)\n        lifecycleScope.launch(Dispatchers.Main) {\n            showFraudCheckIndicator()\n        }\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onkountcollectend","__idx":73},"children":["onKountCollectEnd"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered when Kount fraud detection data collection completes."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track fraud detection completion time."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Hide loading indicators."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log fraud detection completion."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Calculate fraud detection duration."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-13","__idx":74},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onKountCollectEnd: ((Any) -> Unit)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-13","__idx":75},"children":["Event data"]},{"$$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":"Parameter"},"children":["Parameter"]},{"$$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":["data"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Any"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Kount collection completion data."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-14","__idx":76},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onKountCollectStart = { data ->\n        val startTime = System.currentTimeMillis()\n        \n        // Store start time for duration calculation\n        fraudDetectionStartTime = startTime\n        \n        Log.d(\"GooglePay\", \"Kount collection started at $startTime\")\n    }\n    \n    onKountCollectEnd = { data ->\n        val endTime = System.currentTimeMillis()\n        val duration = endTime - fraudDetectionStartTime\n        \n        Log.d(\"GooglePay\", \"Kount collection completed in ${duration}ms\")\n        \n        // Track fraud detection completion\n        analyticsTracker.trackEvent(\"kount_collection_end\") {\n            put(\"timestamp\", endTime)\n            put(\"duration_ms\", duration)\n        }\n        \n        // Hide fraud check indicator\n        lifecycleScope.launch(Dispatchers.Main) {\n            hideFraudCheckIndicator()\n        }\n    }\n}\n\nprivate var fraudDetectionStartTime: Long = 0\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"soft-decline-retry-events","__idx":77},"children":["Soft decline retry events"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpreretrysoftdecline","__idx":78},"children":["onPreRetrySoftDecline"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is triggered before retrying a soft-declined payment with different authentication parameters."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use it to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Configure retry attempts with alternative challenge indicators."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Implement custom retry logic for soft declines."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track soft decline occurrences."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Adjust authentication parameters for better success rates."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Decide whether to retry or abort."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"callback-signature-14","__idx":79},"children":["Callback signature"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPreRetrySoftDecline: ((SubmitResult) -> RetryConfiguration?)?\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data-14","__idx":80},"children":["Event data"]},{"$$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":"Parameter"},"children":["Parameter"]},{"$$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":["result"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["SubmitResult"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Transaction result containing decline information."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.errorCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Error code indicating decline type."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.errorReason"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Human-readable decline reason."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.correlationId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Correlation ID for tracking."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.merchantTransactionId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your transaction identifier."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.systemTransactionId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["System transaction identifier (if available)."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value-6","__idx":81},"children":["Return value"]},{"$$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":["retry"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Boolean"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether to retry the payment."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["updatedConfigs"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["UpdatedConfigs?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Updated callback configurations for retry attempt. Contains optional ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreInitiateAuthentication"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthentication"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}," callbacks."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-implementation-15","__idx":82},"children":["Example implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"import com.pxp.checkout.components.googlepay.types.GooglePayButtonComponentConfig\nimport com.pxp.checkout.services.models.authentication.*\nimport com.pxp.checkout.models.*\nimport com.pxp.checkout.components.threeds.ChallengeWindowSize\n\nval googlePayConfig = GooglePayButtonComponentConfig().apply {\n    onPreRetrySoftDecline = { result ->\n        Log.w(\"GooglePay\", \"Soft decline detected, preparing retry\")\n        Log.w(\"GooglePay\", \"Error code: ${result.errorCode}\")\n        Log.w(\"GooglePay\", \"Decline reason: ${result.errorReason}\")\n        Log.w(\"GooglePay\", \"Correlation ID: ${result.correlationId}\")\n        \n        // Track soft decline\n        analyticsTracker.trackEvent(\"payment_soft_decline\") {\n            put(\"error_code\", result.errorCode)\n            put(\"error_reason\", result.errorReason)\n            put(\"correlation_id\", result.correlationId)\n            put(\"transaction_id\", result.merchantTransactionId)\n        }\n        \n        // Show message to user\n        showMessage(\"Processing payment with additional verification...\")\n        \n        // Retry with forced 3DS challenge\n        GooglePayButtonComponentConfig.RetryConfiguration(\n            retry = true,\n            updatedConfigs = GooglePayButtonComponentConfig.RetryConfiguration.UpdatedConfigs(\n                onPreInitiateAuthentication = {\n                    PreInitiateIntegratedAuthenticationData(\n                        providerId = \"pxpfinancial\",\n                        timeout = 12\n                    )\n                },\n                onPreAuthentication = suspend {\n                    InitiateIntegratedAuthenticationData(\n                        merchantCountryNumericCode = \"826\",\n                        merchantLegalName = \"Your Store Ltd\",\n                        challengeWindowSize = ChallengeWindowSize.FULL_SCREEN,\n                        requestorChallengeIndicator = \n                            RequestorChallengeIndicatorType.CHALLENGE_REQUESTED_MANDATE,\n                        timeout = 300\n                    )\n                }\n            )\n        )\n        \n        // Alternative: Don't retry\n        // GooglePayButtonComponentConfig.RetryConfiguration(retry = false)\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"complete-implementation-example","__idx":83},"children":["Complete implementation example"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here's a comprehensive example showing multiple callbacks working together:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"import androidx.compose.foundation.layout.*\nimport androidx.compose.material3.*\nimport androidx.compose.runtime.*\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.unit.dp\nimport com.pxp.PxpCheckout\nimport com.pxp.checkout.components.googlepay.*\nimport com.pxp.checkout.components.googlepay.types.*\nimport com.pxp.checkout.models.*\nimport com.pxp.checkout.services.kount.*\nimport com.pxp.checkout.types.ComponentType\nimport kotlinx.coroutines.CompletableDeferred\n\n@Composable\nfun GooglePayPaymentScreen(\n    pxpCheckout: PxpCheckout,\n    amount: Double,\n    onSuccess: (String) -> Unit,\n    onError: (String) -> Unit\n) {\n    var errorMessage by remember { mutableStateOf<String?>(null) }\n    var isProcessing by remember { mutableStateOf(false) }\n    \n    val googlePayComponent = remember {\n        pxpCheckout.createComponent<\n            GooglePayButtonComponent,\n            GooglePayButtonComponentConfig\n        >(\n            type = ComponentType.GOOGLE_PAY_BUTTON,\n            config = GooglePayButtonComponentConfig().apply {\n                \n                // Payment configuration\n                style = GooglePayButtonStyle(\n                    type = GooglePayButtonType.PAY,\n                    theme = GooglePayButtonTheme.DARK,\n                    cornerRadius = 8\n                )\n                \n                paymentDataRequest = PaymentDataRequest(\n                    allowedPaymentMethods = listOf(\n                        PaymentMethodSpecification(\n                            parameters = PaymentMethodParameters(\n                                allowedAuthMethods = listOf(\n                                    CardAuthMethod.PAN_ONLY,\n                                    CardAuthMethod.CRYPTOGRAM_3DS\n                                ),\n                                allowedCardNetworks = listOf(\n                                    CardNetwork.VISA,\n                                    CardNetwork.MASTERCARD,\n                                    CardNetwork.AMEX\n                                )\n                            )\n                        )\n                    ),\n                    transactionInfo = TransactionInfo(\n                        currencyCode = \"GBP\",\n                        totalPriceStatus = TotalPriceStatus.FINAL,\n                        totalPrice = amount.toString(),\n                        countryCode = \"GB\"\n                    ),\n                    emailRequired = true\n                )\n                \n                // Enable 3DS with Unity strategy\n                useUnityAuthenticationStrategy = true\n                collectCvc = GooglePayButtonComponentConfig.CvcCollectionStrategy.DEFAULT\n                \n                // Button click callback\n                onGooglePaymentButtonClicked = {\n                    Log.d(\"GooglePay\", \"Button clicked\")\n                    isProcessing = true\n                    errorMessage = null\n                    CompletableDeferred(Unit)\n                }\n                \n                // Pre-authorisation callback\n                onPreAuthorisation = suspend { data ->\n                    Log.d(\"GooglePay\", \"Pre-authorisation: ${data?.gatewayTokenId}\")\n                    \n                    GooglePayTransactionInitData(\n                        riskScreeningData = RiskScreeningData(\n                            performRiskScreening = true,\n                            excludeDeviceData = false,\n                            userIp = \"192.168.1.100\",\n                            account = RiskScreeningAccount(\n                                id = \"user_12345678\",\n                                creationDateTime = \"2024-01-15T10:30:00.000Z\"\n                            ),\n                            fulfillments = listOf(\n                                RiskScreeningFulfillment(\n                                    type = FulfillmentType.SHIPPED,\n                                    recipientPerson = RiskScreeningRecipientPerson(\n                                        phoneNumber = \"+1234567890\"\n                                    )\n                                )\n                            )\n                        )\n                    )\n                }\n                \n                // Post-authorisation callback\n                onPostAuthorisation = { result, paymentData ->\n                    isProcessing = false\n                    \n                    when (result) {\n                        is MerchantSubmitResult -> {\n                            Log.d(\"GooglePay\", \"Payment successful\")\n                            onSuccess(result.merchantTransactionId)\n                        }\n                        is FailedSubmitResult -> {\n                            Log.e(\"GooglePay\", \"Payment failed: ${result.errorReason}\")\n                            errorMessage = result.errorReason\n                            onError(result.errorReason)\n                        }\n                    }\n                }\n                \n                // Error callback\n                onError = { error ->\n                    Log.e(\"GooglePay\", \"Error: ${error.message}\", error)\n                    isProcessing = false\n                    errorMessage = error.message\n                    onError(error.message ?: \"Payment error\")\n                }\n                \n                // Cancel callback\n                onCancel = {\n                    Log.d(\"GooglePay\", \"Payment cancelled\")\n                    isProcessing = false\n                    errorMessage = \"Payment cancelled\"\n                }\n            }\n        )\n    }\n    \n    Column(\n        modifier = Modifier\n            .fillMaxWidth()\n            .padding(16.dp),\n        horizontalAlignment = Alignment.CenterHorizontally\n    ) {\n        Text(\n            text = \"Complete Your Payment\",\n            style = MaterialTheme.typography.headlineMedium\n        )\n        \n        Spacer(modifier = Modifier.height(16.dp))\n        \n        Text(\n            text = \"£${amount}\",\n            style = MaterialTheme.typography.displaySmall\n        )\n        \n        Spacer(modifier = Modifier.height(24.dp))\n        \n        // Render Google Pay button\n        googlePayComponent?.Content(\n            modifier = Modifier.fillMaxWidth()\n        )\n        \n        // Error message\n        errorMessage?.let { error ->\n            Spacer(modifier = Modifier.height(16.dp))\n            Text(\n                text = error,\n                color = MaterialTheme.colorScheme.error,\n                style = MaterialTheme.typography.bodyMedium\n            )\n        }\n        \n        // Processing indicator\n        if (isProcessing) {\n            Spacer(modifier = Modifier.height(16.dp))\n            CircularProgressIndicator()\n        }\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"analytics-events","__idx":84},"children":["Analytics events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK automatically tracks key events throughout the Google Pay payment flow. These analytics events help you monitor payment performance, identify issues, and optimise the user experience."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"automatic-event-tracking","__idx":85},"children":["Automatic event tracking"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following events are tracked automatically without any additional configuration:"]},{"$$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":"Event"},"children":["Event"]},{"$$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":["GooglePayButtonClickAnalyticsEvent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Triggered when the user taps the Google Pay button. Helps track button engagement and conversion funnel entry."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayReadinessCheckAnalyticsEvent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Triggered when the SDK checks if Google Pay is available on the device. Useful for understanding device compatibility."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePaySheetOpenedAnalyticsEvent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Triggered when the Google Pay payment sheet opens. Indicates successful button interaction and sheet loading."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePaySheetCompletedAnalyticsEvent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Triggered when the Google Pay payment sheet closes (either completed or cancelled). Helps track sheet completion rates."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayTokenReceivedAnalyticsEvent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Triggered when a payment token is successfully received from Google Pay. Indicates successful tokenisation."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePayFlowCancelledAnalyticsEvent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Triggered when the user cancels the payment flow. Helps identify drop-off points and cancellation patterns."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentErrorAnalyticsEvent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Triggered when an error occurs during the payment flow. Essential for monitoring error rates and types."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"event-data-structure","__idx":86},"children":["Event data structure"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each analytics event contains:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Event name:"]}," The type of event that occurred."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Timestamp:"]}," When the event was triggered."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Component type:"]}," Always ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GOOGLE_PAY_BUTTON"]}," for Google Pay events."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Additional context:"]}," Event-specific data (e.g., error details, token information)."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"accessing-analytics-data","__idx":87},"children":["Accessing analytics data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Analytics events are automatically sent to the PXP backend and can be viewed in the Unity Portal analytics dashboard. You can use this data to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Monitor conversion rates:"]}," Track how many users complete payments after clicking the button."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Identify technical issues:"]}," Detect patterns in error events and readiness check failures."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Optimise user experience:"]}," Understand where users drop off in the payment flow."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Track performance metrics:"]}," Measure average time from button click to payment completion."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"custom-analytics-integration","__idx":88},"children":["Custom analytics integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you want to integrate with your own analytics platform (e.g., Firebase Analytics, Google Analytics), you can track events using the callback functions:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"import com.google.firebase.analytics.FirebaseAnalytics\nimport com.google.firebase.analytics.ktx.analytics\nimport com.google.firebase.ktx.Firebase\n\nval analytics = Firebase.analytics\n\nval googlePayConfig = GooglePayButtonComponentConfig().apply {\n    \n    onGooglePaymentButtonClicked = {\n        // Track button click\n        analytics.logEvent(\"google_pay_button_clicked\", Bundle().apply {\n            putLong(\"timestamp\", System.currentTimeMillis())\n            putString(\"currency\", \"GBP\")\n            putDouble(\"amount\", 99.99)\n        })\n        CompletableDeferred(Unit)\n    }\n    \n    onPostAuthorisation = { result, paymentData ->\n        when (result) {\n            is MerchantSubmitResult -> {\n                // Track successful payment\n                analytics.logEvent(\"google_pay_payment_success\", Bundle().apply {\n                    putString(\"transaction_id\", result.merchantTransactionId)\n                    putString(\"system_transaction_id\", result.systemTransactionId)\n                })\n            }\n            is FailedSubmitResult -> {\n                // Track failed payment\n                analytics.logEvent(\"google_pay_payment_failed\", Bundle().apply {\n                    putString(\"error_code\", result.errorCode)\n                    putString(\"error_reason\", result.errorReason)\n                    putString(\"correlation_id\", result.correlationId)\n                })\n            }\n        }\n    }\n    \n    onError = { error ->\n        // Track errors\n        analytics.logEvent(\"google_pay_error\", Bundle().apply {\n            putString(\"error_type\", error::class.simpleName)\n            putString(\"error_message\", error.message)\n        })\n    }\n    \n    onCancel = {\n        // Track cancellations\n        analytics.logEvent(\"google_pay_cancelled\", Bundle().apply {\n            putLong(\"timestamp\", System.currentTimeMillis())\n        })\n    }\n}\n","lang":"kotlin"},"children":[]}]},"headings":[{"value":"Events","id":"events","depth":1},{"value":"Overview","id":"overview","depth":2},{"value":"Payment flow events","id":"payment-flow-events","depth":2},{"value":"onPreAuthorisation","id":"onpreauthorisation","depth":3},{"value":"Callback signature","id":"callback-signature","depth":4},{"value":"Event data","id":"event-data","depth":4},{"value":"Return value","id":"return-value","depth":4},{"value":"Example implementation","id":"example-implementation","depth":4},{"value":"onPostAuthorisation","id":"onpostauthorisation","depth":3},{"value":"Callback signature","id":"callback-signature-1","depth":4},{"value":"Event data","id":"event-data-1","depth":4},{"value":"Example implementation","id":"example-implementation-1","depth":4},{"value":"Google Pay sheet interaction events","id":"google-pay-sheet-interaction-events","depth":2},{"value":"onPaymentDataChanged","id":"onpaymentdatachanged","depth":3},{"value":"Callback signature","id":"callback-signature-2","depth":4},{"value":"Event data","id":"event-data-2","depth":4},{"value":"Return value","id":"return-value-1","depth":4},{"value":"Example implementation","id":"example-implementation-2","depth":4},{"value":"onGooglePaymentButtonClicked","id":"ongooglepaymentbuttonclicked","depth":3},{"value":"Callback signature","id":"callback-signature-3","depth":4},{"value":"Event data","id":"event-data-3","depth":4},{"value":"Example implementation","id":"example-implementation-3","depth":4},{"value":"Validation and error events","id":"validation-and-error-events","depth":2},{"value":"onCustomValidation","id":"oncustomvalidation","depth":3},{"value":"Callback signature","id":"callback-signature-4","depth":4},{"value":"Event data","id":"event-data-4","depth":4},{"value":"Return value","id":"return-value-2","depth":4},{"value":"Example implementation","id":"example-implementation-4","depth":4},{"value":"onError","id":"onerror","depth":3},{"value":"Callback signature","id":"callback-signature-5","depth":4},{"value":"Event data","id":"event-data-5","depth":4},{"value":"Exception types","id":"exception-types","depth":4},{"value":"Example implementation","id":"example-implementation-5","depth":4},{"value":"onCancel","id":"oncancel","depth":3},{"value":"Callback signature","id":"callback-signature-6","depth":4},{"value":"Event data","id":"event-data-6","depth":4},{"value":"Example implementation","id":"example-implementation-6","depth":4},{"value":"3D Secure authentication events","id":"3d-secure-authentication-events","depth":2},{"value":"useUnityAuthenticationStrategy","id":"useunityauthenticationstrategy","depth":3},{"value":"Configuration","id":"configuration","depth":4},{"value":"Example implementation","id":"example-implementation-7","depth":4},{"value":"onPreInitiateAuthentication","id":"onpreinitiateauthentication","depth":3},{"value":"Callback signature","id":"callback-signature-7","depth":4},{"value":"Event data","id":"event-data-7","depth":4},{"value":"Return value","id":"return-value-3","depth":4},{"value":"Example implementation","id":"example-implementation-8","depth":4},{"value":"onPostInitiateAuthentication","id":"onpostinitiateauthentication","depth":3},{"value":"Callback signature","id":"callback-signature-8","depth":4},{"value":"Event data","id":"event-data-8","depth":4},{"value":"Example implementation","id":"example-implementation-9","depth":4},{"value":"onPreAuthentication","id":"onpreauthentication","depth":3},{"value":"Callback signature","id":"callback-signature-9","depth":4},{"value":"Event data","id":"event-data-9","depth":4},{"value":"Return value","id":"return-value-4","depth":4},{"value":"Example implementation","id":"example-implementation-10","depth":4},{"value":"onPostAuthentication","id":"onpostauthentication","depth":3},{"value":"Callback signature","id":"callback-signature-10","depth":4},{"value":"Event data","id":"event-data-10","depth":4},{"value":"Example implementation","id":"example-implementation-11","depth":4},{"value":"Consent and token events","id":"consent-and-token-events","depth":2},{"value":"onGetConsent","id":"ongetconsent","depth":3},{"value":"Callback signature","id":"callback-signature-11","depth":4},{"value":"Event data","id":"event-data-11","depth":4},{"value":"Return value","id":"return-value-5","depth":4},{"value":"Example implementation","id":"example-implementation-12","depth":4},{"value":"CVC collection callbacks","id":"cvc-collection-callbacks","depth":2},{"value":"CVC collection configuration","id":"cvc-collection-configuration","depth":3},{"value":"CVC collection strategies","id":"cvc-collection-strategies","depth":3},{"value":"Risk screening events","id":"risk-screening-events","depth":2},{"value":"onKountCollectStart","id":"onkountcollectstart","depth":3},{"value":"Callback signature","id":"callback-signature-12","depth":4},{"value":"Event data","id":"event-data-12","depth":4},{"value":"Example implementation","id":"example-implementation-13","depth":4},{"value":"onKountCollectEnd","id":"onkountcollectend","depth":3},{"value":"Callback signature","id":"callback-signature-13","depth":4},{"value":"Event data","id":"event-data-13","depth":4},{"value":"Example implementation","id":"example-implementation-14","depth":4},{"value":"Soft decline retry events","id":"soft-decline-retry-events","depth":2},{"value":"onPreRetrySoftDecline","id":"onpreretrysoftdecline","depth":3},{"value":"Callback signature","id":"callback-signature-14","depth":4},{"value":"Event data","id":"event-data-14","depth":4},{"value":"Return value","id":"return-value-6","depth":4},{"value":"Example implementation","id":"example-implementation-15","depth":4},{"value":"Complete implementation example","id":"complete-implementation-example","depth":2},{"value":"Analytics events","id":"analytics-events","depth":2},{"value":"Automatic event tracking","id":"automatic-event-tracking","depth":3},{"value":"Event data structure","id":"event-data-structure","depth":3},{"value":"Accessing analytics data","id":"accessing-analytics-data","depth":3},{"value":"Custom analytics integration","id":"custom-analytics-integration","depth":3}],"frontmatter":{"seo":{"title":"Events"}},"lastModified":"2026-07-10T12:23:07.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/android/google-pay/events","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}