{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["sub-heading","admonition","br","details","required"]},"type":"markdown"},"seo":{"title":"Submission component","description":"Transform your commerce with PXP's unified platform—seamless payments, real-time insights, and global growth in one powerful integration.","lang":"en-UK","siteUrl":"https://developer.pxp.io","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"submission-component","__idx":0},"children":["Submission component"]},{"$$mdtype":"Tag","name":"SubHeading","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Learn how to configure the payout submission component for iOS."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview","__idx":1},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutSubmissionComponent"]}," provides a submit button to execute payouts for returning users who have already linked their PayPal accounts. This component handles payout validation, merchant approval, and transaction execution. Use this component alongside the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutAmountComponent"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayPalPayoutReceiverComponent"]}," to create a complete direct payout experience."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"basic-usage","__idx":2},"children":["Basic usage"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"minimal-configuration","__idx":3},"children":["Minimal configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The payout submission component requires minimal component-level configuration, but depends on PayPal wallet credentials in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"// Required: Configure PayPal wallet in CheckoutConfig\nlet paypalConfig = PayPalConfig(\n    payout: PayPalPayoutConfig(\n        paypalWallet: PayPalWallet(\n            email: \"user@example.com\",\n            payerId: \"PAYERID123ABC\",\n            proceedPayoutWithSdk: true\n        )\n    )\n)\n\nlet checkoutConfig = CheckoutConfig(\n    environment: .test,\n    session: sessionData,\n    transactionData: transactionData,\n    merchantShopperId: \"user-123\",\n    ownerId: \"merchant-456\",\n    paypalConfig: paypalConfig\n)\n\nlet pxpCheckout = try PxpCheckout.initialize(config: checkoutConfig)\n\n// Then create the component\nlet config = PayoutSubmissionComponentConfig()\nlet component = try pxpCheckout.create(.payoutSubmission, componentConfig: config)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig.payout.paypalWallet.email"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig.payout.paypalWallet.payerId"]}," fields are required in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig"]}," before ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["create(.payoutSubmission, ...)"]}," can succeed. These credentials should be stored from a previous PayPal OAuth flow."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"with-button-text","__idx":4},"children":["With button text"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Customise the button text:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let config = PayoutSubmissionComponentConfig(\n    submitText: \"Withdraw to PayPal\",\n    submitAccessibilityLabel: \"Withdraw funds to PayPal account\"\n)\nlet component = try pxpCheckout.create(.payoutSubmission, componentConfig: config)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["submitText"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The custom text for the submit button. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"Withdraw with PayPal\""]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["submitAccessibilityLabel"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The accessibility label for the button. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"Withdraw with PayPal\""]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"with-event-handlers","__idx":5},"children":["With event handlers"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add callbacks to handle the payout flow:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let config = PayoutSubmissionComponentConfig(\n    submitText: \"Withdraw Now\",\n    \n    onClick: {\n        print(\"Payout button clicked\")\n    },\n    \n    onPrePayoutSubmit: {\n        let approved = await showApprovalDialog()\n        guard approved else { return nil }\n        return PrePayoutSubmitResult(isApproved: true)\n    },\n    \n    onPostPayout: { result in\n        print(\"Payout completed: \\(result.merchantTransactionId)\")\n    },\n    \n    onError: { error in\n        if let sdkError = error as? BaseSdkException {\n            print(\"Error: \\(sdkError.errorMessage)\")\n        }\n    }\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onClick"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["(() -> Void)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Called when the button is clicked, before payout execution."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPrePayoutSubmit"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["(() async -> PrePayoutSubmitResult?)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Called for merchant approval before payout execution. Only used when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["proceedPayoutWithSdk"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},". Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nil"]}," to cancel."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostPayout"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["((MerchantSubmitResult) -> Void)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Called after the payout completes successfully."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["((Error) -> Void)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Called when an error occurs. Cast to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseSdkException"]}," to access error details."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"advanced-configuration","__idx":6},"children":["Advanced configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more complex implementations, configure styling and callbacks:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let config = PayoutSubmissionComponentConfig(\n    recipientType: .email,\n    wallet: .paypal,\n    submitText: \"Confirm Withdrawal\",\n    submitAccessibilityLabel: \"Confirm withdrawal to PayPal\",\n    \n    // Custom button styling\n    styles: ButtonStateStyles(\n        base: FieldStyle(\n            color: .white,\n            fontSize: 16,\n            backgroundColor: Color(red: 0.0, green: 0.44, blue: 0.73),\n            borderColor: Color(red: 0.0, green: 0.44, blue: 0.73),\n            borderWidth: 0,\n            cornerRadius: 8,\n            padding: EdgeInsets(top: 14, leading: 24, bottom: 14, trailing: 24),\n            opacity: 1.0\n        ),\n        disabled: FieldStyle(\n            color: Color(.systemGray),\n            backgroundColor: Color(.systemGray5),\n            opacity: 0.6\n        ),\n        loading: FieldStyle(\n            color: .white,\n            backgroundColor: Color(red: 0.0, green: 0.37, blue: 0.65),\n            opacity: 0.8\n        )\n    ),\n    \n    onClick: { },\n    onPrePayoutSubmit: {\n        // Perform validation and approval logic\n        return PrePayoutSubmitResult(isApproved: true)\n    },\n    onPostPayout: { result in },\n    onError: { error in }\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recipientType"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayoutRecipientType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The recipient identifier type used in the SDK configuration. Note: The current SDK implementation validates ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".email"]}," in the PayPal wallet config, but internally uses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["payerId"]}," for payout execution. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".email"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["wallet"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayPalPayoutWalletType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The wallet type. Currently only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".paypal"]}," is supported. Any other value throws ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutWalletInvalidException"]},". Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".paypal"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["submitText"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The custom text for the submit button."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["submitAccessibilityLabel"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The accessibility label for the button."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["styles"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["ButtonStateStyles?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Custom button styles for different states."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"event-handling","__idx":7},"children":["Event handling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The payout submission component provides event handlers to manage the payout flow:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let config = PayoutSubmissionComponentConfig(\n    submitText: \"Withdraw\",\n    onClick: { },\n    onPrePayoutSubmit: {\n        return PrePayoutSubmitResult(isApproved: true)\n    },\n    onPostPayout: { result in },\n    onError: { error in }\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Callback"},"children":["Callback"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onClick: (() -> Void)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Called when the button is clicked, before payout execution begins."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPrePayoutSubmit: (() async -> PrePayoutSubmitResult?)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Called for merchant approval before payout execution. Required for payout execution when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["proceedPayoutWithSdk"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},". Return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nil"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isApproved: false"]}," to prevent payout execution."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostPayout: ((MerchantSubmitResult) -> Void)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Called when payout completes successfully. Receives transaction IDs."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError: ((BaseSdkException) -> Void)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Called when an error occurs during payout execution. Note: Most validation errors occur during component creation, not during button click."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Payout execution only happens when all three conditions are met:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig.payout.paypalWallet.proceedPayoutWithSdk"]}," is set to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPrePayoutSubmit"]}," callback is provided."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPrePayoutSubmit"]}," returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PrePayoutSubmitResult(isApproved: true)"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If any condition isn't met, the payout won't execute."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCancel"]}," callback is currently not invoked by the SDK implementation."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onclick","__idx":8},"children":["onClick"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Triggered when the user taps the submit button:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"config.onClick = {\n    print(\"Payout button clicked\")\n    \n    // Track analytics\n    Analytics.track(\"payout_submit_clicked\", properties: [\n        \"userId\": currentUser.id,\n        \"amount\": getCurrentPayoutAmount()\n    ])\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onprepayoutsubmit","__idx":9},"children":["onPrePayoutSubmit"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Triggered before payout execution when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["proceedPayoutWithSdk"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", allowing you to implement approval flows:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"config.onPrePayoutSubmit = {\n    // Perform custom validation\n    let isValid = await validatePayoutEligibility()\n    guard isValid else {\n        showError(\"You are not eligible for this payout\")\n        return nil\n    }\n    \n    // Show approval dialog\n    let approved = await showApprovalDialog(\n        amount: getCurrentPayoutAmount(),\n        recipient: getStoredPayPalEmail()\n    )\n    \n    guard approved else {\n        Analytics.track(\"payout_approval_rejected\")\n        return nil\n    }\n    \n    Analytics.track(\"payout_approval_granted\")\n    return PrePayoutSubmitResult(isApproved: true)\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Payout execution only happens when all three conditions are met:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig.payout.paypalWallet.proceedPayoutWithSdk"]}," is set to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["This ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPrePayoutSubmit"]}," callback is provided."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["This callback returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PrePayoutSubmitResult(isApproved: true)"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If this callback isn't provided, returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nil"]},", or returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isApproved: false"]},", the payout won't execute."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"return-value","__idx":10},"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":["isApproved"]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Bool"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether the payout is approved."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onpostpayout","__idx":11},"children":["onPostPayout"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Triggered after the payout transaction completes successfully:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"config.onPostPayout = { result in\n    print(\"Payout completed!\")\n    print(\"Merchant TX ID: \\(result.merchantTransactionId)\")\n    print(\"System TX ID: \\(result.systemTransactionId)\")\n    \n    // Update records\n    updatePayoutRecord(\n        merchantTxId: result.merchantTransactionId,\n        systemTxId: result.systemTransactionId,\n        status: \"completed\"\n    )\n    \n    // Update user balance\n    updateUserBalance(deduct: getCurrentPayoutAmount())\n    \n    // Show success message\n    showSuccessMessage(\"Your payout has been sent!\")\n    \n    // Track analytics\n    Analytics.track(\"payout_completed\", properties: [\n        \"transactionId\": result.merchantTransactionId,\n        \"amount\": getCurrentPayoutAmount()\n    ])\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"event-data","__idx":12},"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":"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":["result.merchantTransactionId"]},{"$$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":["result.systemTransactionId"]},{"$$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 system transaction ID."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"onerror","__idx":13},"children":["onError"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Triggered when an error occurs during payout execution:"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Most payout validation errors (receiver missing, invalid wallet configuration, etc.) are thrown during component creation via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pxpCheckout.create(.payoutSubmission, ...)"]}," and must be caught with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["try-catch"]},". The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]}," callback is primarily for errors that occur during the actual payout transaction execution."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"config.onError = { error in\n    guard let sdkError = error as? BaseSdkException else {\n        print(\"Unknown error: \\(error.localizedDescription)\")\n        return\n    }\n    \n    print(\"Payout error: \\(sdkError.errorMessage)\")\n    print(\"Error code: \\(sdkError.errorCode)\")\n    \n    // Handle specific errors\n    let errorMessage: String\n    \n    switch sdkError.errorCode {\n    case \"SDK0816\":\n        errorMessage = \"PayPal email address is too long.\"\n    case \"SDK0817\", \"SDK0818\":\n        errorMessage = \"Invalid payer ID. Please re-link your PayPal account.\"\n    case \"SDK0819\":\n        errorMessage = \"Payout transaction failed. Please try again.\"\n    default:\n        // Backend/API/HTTP error codes may also appear here\n        errorMessage = \"Payout failed. Please try again.\"\n    }\n    \n    Task { @MainActor in\n        showErrorDialog(title: \"Payout Error\", message: errorMessage)\n    }\n    \n    // Track error\n    Analytics.track(\"payout_error\", properties: [\n        \"errorCode\": sdkError.errorCode,\n        \"errorMessage\": sdkError.errorMessage\n    ])\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"styling","__idx":14},"children":["Styling"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"default-styling","__idx":15},"children":["Default styling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The payout submission component renders with default button styles:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"// Base state (default)\nFieldStyle(\n    color: Color(red: 9/255, green: 9/255, blue: 12/255),\n    fontSize: 16,\n    backgroundColor: Color(red: 1.0, green: 0.765, blue: 0.220),  // PayPal gold\n    borderColor: .clear,\n    borderWidth: 0,\n    cornerRadius: 3,\n    padding: EdgeInsets(top: 16, leading: 12, bottom: 16, trailing: 12),\n    opacity: 1.0,\n    icon: IconStyle(size: CGSize(width: 60, height: 16))\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"custom-styling","__idx":16},"children":["Custom styling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Override the default appearance with custom styles for three button states:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let config = PayoutSubmissionComponentConfig(\n    submitText: \"Withdraw Now\",\n    styles: ButtonStateStyles(\n        base: FieldStyle(\n            color: .white,\n            fontSize: 18,\n            backgroundColor: Color(red: 0.2, green: 0.7, blue: 0.3),  // Green\n            borderColor: Color(red: 0.2, green: 0.7, blue: 0.3),\n            borderWidth: 0,\n            cornerRadius: 12,\n            padding: EdgeInsets(top: 16, leading: 32, bottom: 16, trailing: 32),\n            opacity: 1.0\n        ),\n        disabled: FieldStyle(\n            color: Color(.systemGray2),\n            backgroundColor: Color(.systemGray5),\n            borderColor: Color(.systemGray5),\n            opacity: 0.5\n        ),\n        loading: FieldStyle(\n            color: .white,\n            backgroundColor: Color(red: 0.15, green: 0.55, blue: 0.25),  // Darker green\n            opacity: 0.9\n        )\n    )\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Style State"},"children":["Style State"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["base"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The normal interactive state. Applied when the button is ready to be clicked."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["disabled"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The disabled state. Can be set by calling ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setDisabled(_:)"]}," on the component."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["loading"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The loading state. Applied during payout processing."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"brand-specific-styling","__idx":17},"children":["Brand-specific styling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Apply your brand colours:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"struct BrandColors {\n    static let primary = Color(red: 0.17, green: 0.24, blue: 0.31)\n    static let accent = Color(red: 0.20, green: 0.60, blue: 0.86)\n    static let success = Color(red: 0.18, green: 0.80, blue: 0.44)\n}\n\nlet config = PayoutSubmissionComponentConfig(\n    submitText: \"Complete Withdrawal\",\n    styles: ButtonStateStyles(\n        base: FieldStyle(\n            color: .white,\n            fontSize: 16,\n            backgroundColor: BrandColors.success,\n            borderColor: BrandColors.success,\n            borderWidth: 0,\n            cornerRadius: 8,\n            padding: EdgeInsets(top: 14, leading: 28, bottom: 14, trailing: 28)\n        ),\n        disabled: FieldStyle(\n            backgroundColor: Color(.systemGray4),\n            opacity: 0.6\n        ),\n        loading: FieldStyle(\n            backgroundColor: BrandColors.primary,\n            opacity: 0.9\n        )\n    )\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"fieldstyle-properties","__idx":18},"children":["FieldStyle properties"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The submission button applies the following ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FieldStyle"]}," 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":{"align":"left","data-label":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Example"},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Color?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The text/foreground colour."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".white"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["font"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Font?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The SwiftUI font for the text."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".body"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fontSize"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CGFloat?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The font size in points."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["16"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["backgroundColor"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Color?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The background colour."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Color(red: 0.0, green: 0.44, blue: 0.73)"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["borderColor"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Color?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The border colour."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".blue"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["borderWidth"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CGFloat?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The border width in points."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cornerRadius"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CGFloat?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The corner radius in points."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["8"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["padding"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["EdgeInsets?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The padding around the content."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["EdgeInsets(top: 14, leading: 24, bottom: 14, trailing: 24)"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opacity"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Double?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The opacity (0.0 - 1.0)."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0.8"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["icon"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IconStyle?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Icon styling with size and tint colour."]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IconStyle(size: CGSize(width: 24, height: 24), tintColor: .white)"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"methods","__idx":19},"children":["Methods"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"buildcontent","__idx":20},"children":["buildContent()"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Renders the submit button in SwiftUI:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"struct PayoutView: View {\n    @State private var submissionComponent: BaseComponent?\n    \n    var body: some View {\n        VStack {\n            if let component = submissionComponent {\n                component.buildContent()\n                    .frame(maxWidth: .infinity)\n                    .frame(height: 50)\n            }\n        }\n        .onAppear {\n            createSubmissionComponent()\n        }\n    }\n    \n    private func createSubmissionComponent() {\n        Task {\n            let config = PayoutSubmissionComponentConfig(\n                submitText: \"Withdraw to PayPal\",\n                onPostPayout: { result in\n                    print(\"Success: \\(result.merchantTransactionId)\")\n                }\n            )\n            \n            let component = try pxpCheckout.create(.payoutSubmission, componentConfig: config)\n            \n            await MainActor.run {\n                self.submissionComponent = component\n            }\n        }\n    }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":21},"children":["Examples"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"basic-submission","__idx":22},"children":["Basic submission"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A simple implementation with essential callbacks:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import SwiftUI\nimport PXPCheckoutSDK\n\nstruct BasicSubmissionView: View {\n    @State private var submissionComponent: BaseComponent?\n    @State private var payoutStatus: String?\n    \n    var body: some View {\n        VStack(spacing: 20) {\n            Text(\"Withdraw Funds\")\n                .font(.title)\n            \n            if let component = submissionComponent {\n                component.buildContent()\n                    .frame(maxWidth: .infinity)\n                    .frame(height: 50)\n            }\n            \n            if let status = payoutStatus {\n                Text(status)\n                    .foregroundColor(.secondary)\n            }\n        }\n        .padding()\n        .onAppear {\n            createComponent()\n        }\n    }\n    \n    private func createComponent() {\n        Task {\n            let config = PayoutSubmissionComponentConfig(\n                submitText: \"Withdraw to PayPal\",\n                \n                onClick: {\n                    print(\"Button clicked\")\n                },\n                \n                onPostPayout: { result in\n                    Task { @MainActor in\n                        payoutStatus = \"Payout completed! TX: \\(result.merchantTransactionId)\"\n                    }\n                },\n                \n                onError: { error in\n                    Task { @MainActor in\n                        if let sdkError = error as? BaseSdkException {\n                            payoutStatus = \"Error: \\(sdkError.errorMessage)\"\n                        } else {\n                            payoutStatus = \"Error: \\(error.localizedDescription)\"\n                        }\n                    }\n                }\n            )\n            \n            let component = try pxpCheckout.create(.payoutSubmission, componentConfig: config)\n            \n            await MainActor.run {\n                self.submissionComponent = component\n            }\n        }\n    }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"with-approval-dialog","__idx":23},"children":["With approval dialog"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Implementation with SwiftUI alert for approval:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"struct ApprovalPayoutView: View {\n    @State private var submissionComponent: BaseComponent?\n    @State private var showApprovalAlert = false\n    @State private var pendingApprovalContinuation: CheckedContinuation<PrePayoutSubmitResult?, Never>?\n    \n    let payoutAmount: Decimal = 100.00\n    \n    var body: some View {\n        VStack(spacing: 20) {\n            Text(\"Withdraw $\\(String(format: \"%.2f\", payoutAmount))\")\n                .font(.title)\n            \n            if let component = submissionComponent {\n                component.buildContent()\n                    .frame(maxWidth: .infinity)\n                    .frame(height: 50)\n            }\n        }\n        .padding()\n        .alert(\"Confirm Payout\", isPresented: $showApprovalAlert) {\n            Button(\"Cancel\", role: .cancel) {\n                pendingApprovalContinuation?.resume(returning: nil)\n                pendingApprovalContinuation = nil\n            }\n            Button(\"Confirm\") {\n                pendingApprovalContinuation?.resume(returning: PrePayoutSubmitResult(isApproved: true))\n                pendingApprovalContinuation = nil\n            }\n        } message: {\n            Text(\"Send $\\(String(format: \"%.2f\", payoutAmount)) to your PayPal account?\")\n        }\n        .onAppear {\n            createComponent()\n        }\n    }\n    \n    private func createComponent() {\n        Task {\n            let config = PayoutSubmissionComponentConfig(\n                submitText: \"Withdraw Now\",\n                \n                onPrePayoutSubmit: { [self] in\n                    return await withCheckedContinuation { continuation in\n                        Task { @MainActor in\n                            self.pendingApprovalContinuation = continuation\n                            self.showApprovalAlert = true\n                        }\n                    }\n                },\n                \n                onPostPayout: { result in\n                    print(\"Payout completed: \\(result.merchantTransactionId)\")\n                    showSuccessScreen()\n                },\n                \n                onError: { error in\n                    if let sdkError = error as? BaseSdkException {\n                        showErrorDialog(sdkError.errorMessage)\n                    } else {\n                        showErrorDialog(error.localizedDescription)\n                    }\n                }\n            )\n            \n            let component = try pxpCheckout.create(.payoutSubmission, componentConfig: config)\n            \n            await MainActor.run {\n                self.submissionComponent = component\n            }\n        }\n    }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"complete-direct-payout-flow","__idx":24},"children":["Complete direct payout flow"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Full implementation with all three direct payout components:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import SwiftUI\nimport PXPCheckoutSDK\n\nstruct DirectPayoutView: View {\n    @State private var pxpCheckout: PxpCheckout?\n    @State private var amountComponent: BaseComponent?\n    @State private var receiverComponent: BaseComponent?\n    @State private var submissionComponent: BaseComponent?\n    @State private var isLoading = true\n    @State private var showApprovalAlert = false\n    @State private var showSuccessAlert = false\n    @State private var pendingApprovalContinuation: CheckedContinuation<PrePayoutSubmitResult?, Never>?\n    @State private var completedTransactionId: String?\n    \n    let payoutAmount: Decimal = 100.00\n    let storedPayPalEmail: String = \"user@example.com\"\n    let storedPayerId: String = \"PAYERID123ABC\"\n    \n    var body: some View {\n        NavigationView {\n            VStack(spacing: 24) {\n                if isLoading {\n                    ProgressView(\"Loading...\")\n                } else {\n                    // Header\n                    VStack(spacing: 8) {\n                        Text(\"Withdraw to PayPal\")\n                            .font(.title)\n                            .fontWeight(.bold)\n                        \n                        Text(\"Funds will arrive in 1-2 business days\")\n                            .font(.subheadline)\n                            .foregroundColor(.secondary)\n                    }\n                    \n                    // Amount display\n                    if let amount = amountComponent {\n                        amount.buildContent()\n                            .frame(maxWidth: .infinity)\n                    }\n                    \n                    // Receiver display\n                    if let receiver = receiverComponent {\n                        receiver.buildContent()\n                            .frame(maxWidth: .infinity)\n                    }\n                    \n                    Spacer()\n                    \n                    // Submit button\n                    if let submit = submissionComponent {\n                        submit.buildContent()\n                            .frame(maxWidth: .infinity)\n                            .frame(height: 50)\n                    }\n                }\n            }\n            .padding()\n            .alert(\"Confirm Payout\", isPresented: $showApprovalAlert) {\n                Button(\"Cancel\", role: .cancel) {\n                    pendingApprovalContinuation?.resume(returning: nil)\n                    pendingApprovalContinuation = nil\n                }\n                Button(\"Confirm\") {\n                    pendingApprovalContinuation?.resume(returning: PrePayoutSubmitResult(isApproved: true))\n                    pendingApprovalContinuation = nil\n                }\n            } message: {\n                Text(\"Send $\\(String(format: \"%.2f\", payoutAmount)) to \\(storedPayPalEmail)?\")\n            }\n            .alert(\"Payout Successful!\", isPresented: $showSuccessAlert) {\n                Button(\"Done\") {\n                    // Navigate away\n                }\n            } message: {\n                Text(\"Your payout has been sent. Transaction ID: \\(completedTransactionId ?? \"\")\")\n            }\n            .onAppear {\n                initializePayoutComponents()\n            }\n        }\n    }\n    \n    private func initializePayoutComponents() {\n        Task {\n            do {\n                // Initialise SDK with stored credentials\n                let sessionData = SessionData(\n                    sessionId: \"your-session-id\",\n                    hmacKey: \"your-hmac-key\",\n                    encryptionKey: \"your-encryption-key\"\n                )\n                \n                let transactionData = TransactionData(\n                    amount: payoutAmount,\n                    currency: \"USD\",\n                    entryType: .ecom,\n                    intent: TransactionIntentData(card: nil, paypal: .payout),\n                    merchantTransactionId: \"payout-\\(UUID().uuidString)\",\n                    merchantTransactionDate: { Date() }\n                )\n                \n                let paypalConfig = PayPalConfig(\n                    payout: PayPalPayoutConfig(\n                        paypalWallet: PayPalWallet(\n                            email: storedPayPalEmail,\n                            payerId: storedPayerId,\n                            proceedPayoutWithSdk: true\n                        )\n                    )\n                )\n                \n                let checkoutConfig = CheckoutConfig(\n                    environment: .test,\n                    session: sessionData,\n                    transactionData: transactionData,\n                    merchantShopperId: \"user-123\",\n                    ownerId: \"merchant-456\",\n                    paypalConfig: paypalConfig\n                )\n                \n                let pxpCheckout = try PxpCheckout.initialize(config: checkoutConfig)\n                self.pxpCheckout = pxpCheckout\n                \n                // Create amount component\n                let amountConfig = PayoutAmountComponentConfig(\n                    label: \"Payout Amount\",\n                    styles: FieldStyle(\n                        backgroundColor: Color(.systemGray6),\n                        cornerRadius: 12,\n                        padding: EdgeInsets(top: 20, leading: 20, bottom: 20, trailing: 20),\n                        textAlignment: .center\n                    ),\n                    inputStyles: FieldInputStateStyles(\n                        base: FieldInputStyle(\n                            color: Color(red: 0.2, green: 0.7, blue: 0.3),\n                            fontSize: 32,\n                            fontWeight: .bold\n                        )\n                    )\n                )\n                let amount = try pxpCheckout.create(.payoutAmount, componentConfig: amountConfig)\n                \n                // Create receiver component\n                let receiverConfig = PayPalPayoutReceiverComponentConfig(\n                    label: \"PayPal Account\",\n                    applyMask: true,\n                    showMaskToggle: true,\n                    styles: FieldStyle(\n                        backgroundColor: Color(red: 0.0, green: 0.44, blue: 0.73).opacity(0.05),\n                        borderColor: Color(red: 0.0, green: 0.44, blue: 0.73).opacity(0.3),\n                        borderWidth: 1,\n                        cornerRadius: 12,\n                        padding: EdgeInsets(top: 16, leading: 20, bottom: 16, trailing: 20)\n                    )\n                )\n                let receiver = try pxpCheckout.create(.paypalPayoutReceiver, componentConfig: receiverConfig)\n                \n                // Create submission component\n                let submissionConfig = PayoutSubmissionComponentConfig(\n                    submitText: \"Withdraw to PayPal\",\n                    submitAccessibilityLabel: \"Withdraw funds to PayPal account\",\n                    \n                    styles: ButtonStateStyles(\n                        base: FieldStyle(\n                            color: .white,\n                            fontSize: 18,\n                            backgroundColor: Color(red: 0.0, green: 0.44, blue: 0.73),\n                            cornerRadius: 12,\n                            padding: EdgeInsets(top: 16, leading: 32, bottom: 16, trailing: 32)\n                        ),\n                        disabled: FieldStyle(\n                            backgroundColor: Color(.systemGray4),\n                            opacity: 0.6\n                        ),\n                        loading: FieldStyle(\n                            backgroundColor: Color(red: 0.0, green: 0.37, blue: 0.65),\n                            opacity: 0.9\n                        )\n                    ),\n                    \n                    onClick: {\n                        print(\"Withdraw button clicked\")\n                        Analytics.track(\"direct_payout_clicked\")\n                    },\n                    \n                    onPrePayoutSubmit: { [self] in\n                        return await withCheckedContinuation { continuation in\n                            Task { @MainActor in\n                                self.pendingApprovalContinuation = continuation\n                                self.showApprovalAlert = true\n                            }\n                        }\n                    },\n                    \n                    onPostPayout: { [self] result in\n                        print(\"Payout completed: \\(result.merchantTransactionId)\")\n                        \n                        Task { @MainActor in\n                            completedTransactionId = result.merchantTransactionId\n                            showSuccessAlert = true\n                        }\n                        \n                        Analytics.track(\"direct_payout_completed\", properties: [\n                            \"transactionId\": result.merchantTransactionId,\n                            \"amount\": payoutAmount\n                        ])\n                    },\n                    \n                    onError: { error in\n                        guard let sdkError = error as? BaseSdkException else {\n                            print(\"Payout error: \\(error.localizedDescription)\")\n                            \n                            Task { @MainActor in\n                                showErrorAlert(error.localizedDescription)\n                            }\n                            \n                            Analytics.track(\"direct_payout_error\", properties: [\n                                \"errorCode\": \"UNKNOWN\"\n                            ])\n                            return\n                        }\n                        \n                        print(\"Payout error: \\(sdkError.errorCode) - \\(sdkError.errorMessage)\")\n                        \n                        Task { @MainActor in\n                            showErrorAlert(sdkError.errorMessage)\n                        }\n                        \n                        Analytics.track(\"direct_payout_error\", properties: [\n                            \"errorCode\": sdkError.errorCode\n                        ])\n                    }\n                )\n                let submission = try pxpCheckout.create(.payoutSubmission, componentConfig: submissionConfig)\n                \n                await MainActor.run {\n                    self.amountComponent = amount\n                    self.receiverComponent = receiver\n                    self.submissionComponent = submission\n                    self.isLoading = false\n                }\n            } catch {\n                print(\"Initialisation error: \\(error.localizedDescription)\")\n                await MainActor.run {\n                    self.isLoading = false\n                }\n            }\n        }\n    }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"error-handling","__idx":25},"children":["Error handling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The submission component can throw errors during component creation and during payout execution:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"component-creation-errors","__idx":26},"children":["Component creation errors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These errors are thrown when calling ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pxpCheckout.create(.payoutSubmission, ...)"]}," and must be caught with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["try-catch"]},":"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Error code"},"children":["Error code"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Exception"},"children":["Exception"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0803"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaypalPayoutReceiverRequiredException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The receiver is required."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0804"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutReceiverTypeInvalidException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Invalid receiver type."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0806"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutWalletInvalidException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Invalid wallet value. Only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".paypal"]}," is currently supported."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0807"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutWalletRequiresEmailException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The PayPal wallet configuration requires an email address. Both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["payerId"]}," must be provided in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig.payout.paypalWallet"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0808"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaypalPayoutEmailInvalidException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Invalid email format."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0809"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutPayerIdRequiredException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The payer ID is required."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0816"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutEmailMaxLengthException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The PayPal email address exceeds the maximum length."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0817"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutPayerIdMaxLengthException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The payer ID exceeds 13 characters."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0818"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutPayerIdInvalidException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The payer ID contains invalid characters."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"payout-execution-errors","__idx":27},"children":["Payout execution errors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These errors are passed to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onError"]}," callback during payout execution:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Error code"},"children":["Error code"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Exception"},"children":["Exception"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0816"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutEmailMaxLengthException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The PayPal email address exceeds the maximum length."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0817"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutPayerIdMaxLengthException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The payer ID exceeds 13 characters."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0818"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutPayerIdInvalidException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The payer ID contains invalid characters."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["SDK0819"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutFailedException"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The payout transaction failed. May also include backend/API/HTTP error codes."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Amount and currency validation errors (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK0810"]},"-",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SDK0815"]},") belong to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayoutAmountComponent"]}," and won't appear in submission component errors."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For a complete list of error codes, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/paypal/payouts/data-validation"},"children":["Data validation"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"error-handling-example","__idx":28},"children":["Error handling example"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"handling-component-creation-errors","__idx":29},"children":["Handling component creation errors"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"do {\n    let config = PayoutSubmissionComponentConfig(\n        submitText: \"Withdraw to PayPal\",\n        onError: { error in\n            // Handle execution-time errors\n            handlePayoutError(error)\n        }\n    )\n    \n    let component = try pxpCheckout.create(.payoutSubmission, componentConfig: config)\n    \n} catch let error as BaseSdkException {\n    // Handle creation-time errors\n    let userMessage: String\n    \n    switch error.errorCode {\n    case \"SDK0803\", \"SDK0804\", \"SDK0808\":\n        userMessage = \"Invalid PayPal account configuration. Please contact support.\"\n        \n    case \"SDK0806\":\n        userMessage = \"Invalid wallet type. Only PayPal wallets are currently supported.\"\n        \n    case \"SDK0807\":\n        userMessage = \"PayPal wallet configuration is incomplete. Both email and payer ID are required.\"\n        \n    case \"SDK0809\", \"SDK0816\", \"SDK0817\", \"SDK0818\":\n        userMessage = \"PayPal account information is invalid. Please re-link your account.\"\n        \n    default:\n        userMessage = \"Failed to initialize payout. Please contact support.\"\n    }\n    \n    showErrorDialog(title: \"Configuration Error\", message: userMessage)\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"handling-payout-execution-errors","__idx":30},"children":["Handling Payout Execution Errors"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"config.onError = { error in\n    guard let sdkError = error as? BaseSdkException else {\n        Task { @MainActor in\n            showErrorDialog(\n                title: \"Payout Error\",\n                message: \"An error occurred. Please try again.\",\n                showRetryButton: true\n            )\n        }\n        return\n    }\n    \n    let userMessage: String\n    let shouldRetry: Bool\n    \n    switch sdkError.errorCode {\n    case \"SDK0816\", \"SDK0817\", \"SDK0818\":\n        userMessage = \"PayPal account information is invalid. Please re-link your account.\"\n        shouldRetry = false\n        \n    case \"SDK0819\":\n        userMessage = \"Payout transaction failed. Please try again.\"\n        shouldRetry = true\n        \n    default:\n        // May include backend/API/HTTP error codes\n        userMessage = \"An error occurred. Please try again.\"\n        shouldRetry = true\n    }\n    \n    Task { @MainActor in\n        showErrorDialog(\n            title: \"Payout Error\",\n            message: userMessage,\n            showRetryButton: shouldRetry\n        )\n    }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":31},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before using the payout submission component, ensure you have:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Configured the transaction data with a valid payout amount:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let payoutAmount: Decimal = 100.00\n\nlet transactionData = TransactionData(\n    amount: payoutAmount,\n    currency: \"USD\",\n    entryType: .ecom,\n    intent: TransactionIntentData(card: nil, paypal: .payout),\n    merchantTransactionId: \"payout-\\(UUID().uuidString)\",\n    merchantTransactionDate: { Date() }\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":2},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Initialised the SDK with stored PayPal credentials:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let sessionData = SessionData(\n    sessionId: \"your-session-id\",\n    hmacKey: \"your-hmac-key\",\n    encryptionKey: \"your-encryption-key\"\n)\n\nlet paypalConfig = PayPalConfig(\n    payout: PayPalPayoutConfig(\n        paypalWallet: PayPalWallet(\n            email: \"user@example.com\",        // Required: Stored from previous OAuth\n            payerId: \"PAYERID123ABC\",         // Required: Stored from previous OAuth\n            proceedPayoutWithSdk: true        // Required for payout execution\n        )\n    )\n)\n\nlet checkoutConfig = CheckoutConfig(\n    environment: .test,\n    session: sessionData,\n    transactionData: transactionData,\n    merchantShopperId: \"user-123\",\n    ownerId: \"merchant-456\",\n    paypalConfig: paypalConfig\n)\n\nlet pxpCheckout = try PxpCheckout.initialize(config: checkoutConfig)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig.payout.paypalWallet.email"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig.payout.paypalWallet.payerId"]}," are required in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig"]}," before ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["create(.payoutSubmission, ...)"]}," can succeed. These credentials should be stored from a previous PayPal OAuth flow."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the SDK to execute payouts, all three conditions must be met:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["proceedPayoutWithSdk"]}," must be set to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPrePayoutSubmit"]}," callback must be provided in the component configuration."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPrePayoutSubmit"]}," must return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PrePayoutSubmitResult(isApproved: true)"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If any condition isn't met, the payout won't execute."]}]}]},"headings":[{"value":"Submission component","id":"submission-component","depth":1},{"value":"Overview","id":"overview","depth":2},{"value":"Basic usage","id":"basic-usage","depth":2},{"value":"Minimal configuration","id":"minimal-configuration","depth":3},{"value":"With button text","id":"with-button-text","depth":3},{"value":"With event handlers","id":"with-event-handlers","depth":3},{"value":"Advanced configuration","id":"advanced-configuration","depth":3},{"value":"Event handling","id":"event-handling","depth":2},{"value":"onClick","id":"onclick","depth":3},{"value":"onPrePayoutSubmit","id":"onprepayoutsubmit","depth":3},{"value":"Return value","id":"return-value","depth":4},{"value":"onPostPayout","id":"onpostpayout","depth":3},{"value":"Event data","id":"event-data","depth":4},{"value":"onError","id":"onerror","depth":3},{"value":"Styling","id":"styling","depth":2},{"value":"Default styling","id":"default-styling","depth":3},{"value":"Custom styling","id":"custom-styling","depth":3},{"value":"Brand-specific styling","id":"brand-specific-styling","depth":3},{"value":"FieldStyle properties","id":"fieldstyle-properties","depth":3},{"value":"Methods","id":"methods","depth":2},{"value":"buildContent()","id":"buildcontent","depth":3},{"value":"Examples","id":"examples","depth":2},{"value":"Basic submission","id":"basic-submission","depth":3},{"value":"With approval dialog","id":"with-approval-dialog","depth":3},{"value":"Complete direct payout flow","id":"complete-direct-payout-flow","depth":3},{"value":"Error handling","id":"error-handling","depth":2},{"value":"Component creation errors","id":"component-creation-errors","depth":3},{"value":"Payout execution errors","id":"payout-execution-errors","depth":3},{"value":"Error handling example","id":"error-handling-example","depth":3},{"value":"Handling component creation errors","id":"handling-component-creation-errors","depth":4},{"value":"Handling Payout Execution Errors","id":"handling-payout-execution-errors","depth":4},{"value":"Prerequisites","id":"prerequisites","depth":2}],"frontmatter":{"seo":{"title":"Submission component"}},"lastModified":"2026-06-12T11:56:36.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/ios/paypal/payouts/submission-component","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}