{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["sub-heading","admonition","br","details","required"]},"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":"SubHeading","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Implement callbacks to customise your Aeropay payment flow for Android."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview","__idx":1},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Aeropay callbacks let your application respond to shopper interaction, custom validation, user verification, popup cancellation, transaction submission, and errors."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use callbacks to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Block the flow when checkout isn't ready."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Save the verified Aeropay user ID for returning-shopper flows."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate business rules before submitting a transaction."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify successful transactions on your backend."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Restore your checkout interface when the shopper dismisses the popup."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log errors and show appropriate recovery options."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}," on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpSdkConfig"]},". Configure the other callbacks on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AeropayButtonComponentConfig"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"basic-event-handling","__idx":2},"children":["Basic event handling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example implements the main Aeropay callbacks:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val sdkConfig = PxpSdkConfig(\n    // ...session and transaction configuration\n    onGetShopper = {\n        Shopper(\n            id = \"shopper-123\",\n            firstName = \"John\",\n            lastName = \"Doe\",\n            email = \"john.doe@example.com\",\n            phoneNumber = \"+14155550123\",\n        )\n    },\n)\n\nval config = AeropayButtonComponentConfig().apply {\n    onClick = {\n        clearPaymentErrors()\n    }\n    onCustomValidation = {\n        val checkoutReady = validateCheckoutReady()\n        if (!checkoutReady) {\n            showPaymentError(\"Checkout isn't ready for Aeropay.\")\n        }\n        checkoutReady\n    }\n    onUserVerificationSuccess = { user ->\n        saveAeropayUserId(user.id)\n    }\n    onCancel = {\n        resetCheckoutState()\n    }\n    onPreAuthorisation = {\n        val validation = validateOrderOnBackend()\n        if (!validation.approved) {\n            showPaymentError(validation.message)\n        }\n        validation.approved\n    }\n    onPostAuthorisation = { result ->\n        verifyPaymentOnBackend(result)\n    }\n    onSubmitError = { error ->\n        showAlternativePaymentMethods()\n    }\n    onError = { error ->\n        showPaymentError(\"Unable to complete the Aeropay flow.\")\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Client callbacks aren't proof of payment. Verify every transaction on your backend before fulfilling an order or confirming a payout."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"callback-order","__idx":3},"children":["Callback order"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"new-shopper-flow","__idx":4},"children":["New-shopper flow"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For a successful new-shopper transaction, callbacks run in this order:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onClick"]}," runs when the shopper taps the button."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCustomValidation"]}," runs. Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," to stop before the flow starts."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["After ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCustomValidation"]}," returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", the SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}," (if configured) to load shopper details for prefilling and validation."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The component displays the consumer data and OTP screens."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onUserVerificationSuccess"]}," runs after successful OTP verification."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}," runs after the shopper selects a bank account and confirms the transaction."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["After ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}," returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", the SDK may call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}," again when building the transaction request, then submits the transaction."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostAuthorisation"]}," runs after successful transaction submission."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If the shopper dismisses the popup, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCancel"]}," runs. Flow errors call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]},", while transaction submission failures call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"returning-shopper-flow","__idx":5},"children":["Returning-shopper flow"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you provide ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]},", the SDK skips consumer data collection and OTP verification. A successful returning-shopper transaction follows this order:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onClick"]}," runs after the shopper taps the button."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCustomValidation"]}," runs. Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," to stop before user lookup."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The SDK validates ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]}," and opens bank selection."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}," runs after the shopper selects a bank account and confirms the transaction."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostAuthorisation"]}," runs after successful transaction submission."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The returning-shopper flow doesn't call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onUserVerificationSuccess"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sdk-data-callbacks","__idx":6},"children":["SDK data callbacks"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ongetshopper","__idx":7},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}," on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpSdkConfig"]},". The SDK can call it more than once during a successful flow:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["After ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCustomValidation"]}," returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", to prefill and validate consumer data before the popup opens."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["At transaction submission, to populate ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionRequest.shopper"]},". If the callback is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," or omitted, the SDK falls back to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.shopper"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For a returning shopper with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]},", the SDK doesn't need ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]}," to open the popup, but it can still call the callback when building the transaction request."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return consistent shopper data on every invocation, or set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.shopper"]}," if the callback shouldn't run again at submit."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the callback to return the latest shopper data from your application:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onGetShopper = {\n    val shopper = getCurrentShopper()\n    Shopper(\n        id = shopper.id,\n        firstName = shopper.firstName,\n        lastName = shopper.lastName,\n        email = shopper.email,\n        phoneNumber = shopper.phoneNumber,\n    )\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Aeropay flow uses these shopper properties:"]},{"$$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":{"width":"20%","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":["id"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your shopper identifier. Include a stable value so you can associate the transaction with your customer record."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["firstName"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The shopper's given name. Used to prefill consumer data and included in the transaction request."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lastName"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The shopper's family name. Used to prefill consumer data and included in the transaction request."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The shopper's email address. Used to prefill consumer data and included in the transaction request."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The shopper's US phone number, including the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["+1"]}," country prefix. Used to prefill consumer data, OTP delivery, and the transaction request."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The new-shopper flow validates any values returned for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["firstName"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lastName"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]},". Invalid data calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]}," and prevents the popup from opening."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"aeropay-component-callbacks","__idx":8},"children":["Aeropay component callbacks"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure the following callbacks on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AeropayButtonComponentConfig"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onclick","__idx":9},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onClick"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onClick"]}," when the shopper taps the Aeropay button. Custom validation and popup opening happen after this callback."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this callback to clear previous errors, update your checkout interface, or track the interaction:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onClick = {\n    clearPaymentErrors()\n    setCheckoutActive(true)\n    trackEvent(\"aeropay-button-clicked\")\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"oncustomvalidation","__idx":10},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCustomValidation"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCustomValidation"]}," after ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onClick"]}," and before the Aeropay flow starts. Because the callback is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["suspend"]},", you can call network APIs directly."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," to continue or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," to stop:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onCustomValidation = {\n    val checkoutReady = validateCheckoutReady()\n    if (!checkoutReady) {\n        showPaymentError(\"Checkout isn't ready for Aeropay.\")\n    }\n    checkoutReady\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If the callback is omitted, the SDK treats the result as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"."]},{"$$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":{"width":"20%","data-label":"Return value"},"children":["Return value "]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Behaviour"},"children":["Behaviour"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The SDK continues with returning-user lookup or new-shopper shopper-data checks."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The SDK stops and doesn't open the popup."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onuserverificationsuccess","__idx":11},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onUserVerificationSuccess"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onUserVerificationSuccess"]}," after a new shopper enters the correct OTP. The callback isn't called for returning shoppers who enter the flow with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is optional. If you don't configure it, the SDK continues the Aeropay flow after OTP verification."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Store the returned Aeropay user ID securely so you can use the returning-shopper flow:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onUserVerificationSuccess = { user ->\n    saveAeropayUserId(\n        shopperId = getCurrentShopperId(),\n        aeropayUserId = user.id,\n    )\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The callback receives an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AeropayUser"]}," object:"]},{"$$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":{"width":"15%","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":["id"]},{"$$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":["The verified Aeropay user ID."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["firstName"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The user's given name."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lastName"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The user's family name."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["type"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The Aeropay user type."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The user's email address."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phoneNumber"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The user's phone number."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["createdDate"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The date and time when the Aeropay user was created."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"oncancel","__idx":12},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCancel"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCancel"]}," when the shopper dismisses the Aeropay popup, including the close control and system back or scrim dismiss."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Programmatic dismissal after a successful payment doesn't call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCancel"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this callback to restore your checkout interface without treating cancellation as an error:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onCancel = {\n    setCheckoutActive(false)\n    setLoading(false)\n    showAlternativePaymentMethods()\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback receives no parameters and has no return value."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpreauthorisation","__idx":13},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}," after the shopper selects a bank account and confirms the payment or payout. Use it to validate your order or payout before the SDK submits the transaction."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," to continue or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," to stop submission:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPreAuthorisation = {\n    val validation = validateOrderOnBackend()\n    if (!validation.approved) {\n        showPaymentError(validation.message)\n    }\n    validation.approved\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The callback controls transaction submission as follows:"]},{"$$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":"Behaviour"},"children":["Behaviour"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The SDK builds and submits the transaction."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The SDK stops transaction submission and leaves the Aeropay flow open."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Implement ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}," and return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," when the transaction can proceed. If the callback is omitted or doesn't return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", the SDK doesn't submit the transaction."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpostauthorisation","__idx":14},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostAuthorisation"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostAuthorisation"]}," after PXP accepts the transaction submission. The successful payload is a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MerchantSubmitResult"]}," containing the transaction identifiers."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This callback is optional. If you don't configure it, the SDK continues the Aeropay flow after successful submission and the popup still closes."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Send the identifiers to your backend and verify the final transaction state:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onPostAuthorisation = { submitResult ->\n    verifyPaymentOnBackend(\n        merchantTransactionId = submitResult.merchantTransactionId,\n        systemTransactionId = submitResult.systemTransactionId,\n    )\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The successful payload contains these properties:"]},{"$$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":{"width":"20%","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":["merchantTransactionId"]},{"$$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":["Your unique transaction identifier."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["systemTransactionId"]},{"$$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":["PXP's unique transaction identifier."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onsubmiterror","__idx":15},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]}," when transaction submission fails. It isn't used for consumer data, user verification, bank account, or Aerosync failures. Those errors call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Handle submission failures without exposing technical details to the shopper:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"import com.pxp.checkout.models.FailedSubmitResult\n\nonSubmitError = { submitError ->\n    if (submitError is FailedSubmitResult) {\n        logPaymentFailure(\n            errorCode = submitError.errorCode,\n            correlationId = submitError.correlationId,\n        )\n    }\n    setLoading(false)\n    showPaymentError(\"We could not complete the transaction. Try again or use another payment method.\")\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A failed PXP response typically passes a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]},":"]},{"$$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":{"width":"20%","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":["errorCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The transaction error code."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorReason"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A description of the failure."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["correlationId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The correlation identifier to include in logs and support requests."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["httpStatusCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Int?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The HTTP status code returned by PXP."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["details"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["List<String>?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Additional error details."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When a failed Unity transaction response is mapped to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]},", the SDK also emits ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentError"]}," analytics with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK1326"]},". Network or transport failures still call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]},", but their ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentError"]}," analytics can use a different code, such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK0500"]},". Neither path delivers ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK1326"]}," through ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]},". Handle the response details from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onerror","__idx":16},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK calls ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]}," for errors outside transaction submission, including:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Invalid shopper data."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Aeropay user creation or verification failure."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Returning-user lookup: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK1307"]}," (inactive), ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK1308"]}," (recognised API failure). Network errors on the same call use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK0500"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK0000"]},", not ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK1308"]},". See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/android/aeropay/troubleshooting#sdk1307-or-sdk1308"},"children":["Returning-shopper issues"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Bank account retrieval or linking failure."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Aerosync failure."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Missing host Activity when launching Aerosync (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK1311"]},")."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Log recognised SDK errors and show a message that helps the shopper recover:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"onError = { error ->\n    logErrorToMonitoring(\n        errorCode = error.errorCode,\n        message = error.message,\n        details = error.details,\n    )\n    setLoading(false)\n    showPaymentError(\"Unable to continue with Aeropay. Try again or use another payment method.\")\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For prefilled shopper validation failures (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK1300"]},"), inspect ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error.details"]}," for the field keys and localised validation messages."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Recognised SDK failures use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseSdkException"]},":"]},{"$$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":{"width":"20%","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":["errorCode"]},{"$$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":["The PXP Android SDK error code (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK1300"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]},{"$$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":["A description of the error."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["details"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Any?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional structured detail. For ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK1300"]},", a map of field names to validation messages."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"event-data-structures","__idx":17},"children":["Event data structures"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"aeropayuser","__idx":18},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AeropayUser"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onUserVerificationSuccess"]}," receives the following object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"import com.pxp.checkout.components.aeropaybutton.types.AeropayUser\n\ndata class AeropayUser(\n    val id: String,\n    val firstName: String? = null,\n    val lastName: String? = null,\n    val type: String? = null,\n    val email: String? = null,\n    val phoneNumber: String? = null,\n    val createdDate: String? = null,\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"merchantsubmitresult","__idx":19},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MerchantSubmitResult"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Successful transaction submission produces a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MerchantSubmitResult"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["merchantTransactionId"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["systemTransactionId"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"failedsubmitresult","__idx":20},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A failed PXP transaction response produces a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FailedSubmitResult"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorCode"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorReason"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["correlationId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["httpStatusCode"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["details"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"basesdkexception","__idx":21},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseSdkException"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Recognised ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]}," failures use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseSdkException"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorCode"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]},", and optional ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["details"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"error-handling-pattern","__idx":22},"children":["Error-handling pattern"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Keep error logging separate from the message shown to the shopper. The following pattern records diagnostic information while displaying a neutral recovery message:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val config = AeropayButtonComponentConfig().apply {\n    onPreAuthorisation = { true }\n\n    onPostAuthorisation = { result ->\n        try {\n            verifyPaymentOnBackend(result)\n            showPaymentSuccess()\n        } catch (exception: Exception) {\n            showPaymentError(\"We could not confirm the transaction status. Contact support before trying again.\")\n        }\n    }\n\n    onSubmitError = { error ->\n        reportErrorToMonitoring(error)\n        showPaymentError(\"We could not complete the transaction. Try another payment method.\")\n    }\n\n    onError = { error ->\n        reportErrorToMonitoring(\n            errorCode = error.errorCode,\n            message = error.message,\n            details = error.details,\n        )\n        showPaymentError(\"Unable to continue with Aeropay. Try again or use another payment method.\")\n    }\n}\n","lang":"kotlin"},"children":[]}]},"headings":[{"value":"Events","id":"events","depth":1},{"value":"Overview","id":"overview","depth":2},{"value":"Basic event handling","id":"basic-event-handling","depth":2},{"value":"Callback order","id":"callback-order","depth":2},{"value":"New-shopper flow","id":"new-shopper-flow","depth":3},{"value":"Returning-shopper flow","id":"returning-shopper-flow","depth":3},{"value":"SDK data callbacks","id":"sdk-data-callbacks","depth":2},{"value":"onGetShopper","id":"ongetshopper","depth":3},{"value":"Aeropay component callbacks","id":"aeropay-component-callbacks","depth":2},{"value":"onClick","id":"onclick","depth":3},{"value":"onCustomValidation","id":"oncustomvalidation","depth":3},{"value":"onUserVerificationSuccess","id":"onuserverificationsuccess","depth":3},{"value":"onCancel","id":"oncancel","depth":3},{"value":"onPreAuthorisation","id":"onpreauthorisation","depth":3},{"value":"onPostAuthorisation","id":"onpostauthorisation","depth":3},{"value":"onSubmitError","id":"onsubmiterror","depth":3},{"value":"onError","id":"onerror","depth":3},{"value":"Event data structures","id":"event-data-structures","depth":2},{"value":"AeropayUser","id":"aeropayuser","depth":3},{"value":"MerchantSubmitResult","id":"merchantsubmitresult","depth":3},{"value":"FailedSubmitResult","id":"failedsubmitresult","depth":3},{"value":"BaseSdkException","id":"basesdkexception","depth":3},{"value":"Error-handling pattern","id":"error-handling-pattern","depth":2}],"frontmatter":{"seo":{"title":"Events"}},"lastModified":"2026-08-13T10:57:11.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/android/aeropay/events","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}