{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["sub-heading","br","details","required","admonition","accordion"]},"type":"markdown"},"seo":{"title":"Implementation","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":"implementation","__idx":0},"children":["Implementation"]},{"$$mdtype":"Tag","name":"SubHeading","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Learn how to use card components in your iOS project."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview","__idx":1},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every card flow follows the same pattern:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Build ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig"]}," and call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpCheckout.initialize(config:)"]}," (once per checkout session)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Create components with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["try pxpCheckout.create(_:componentConfig:)"]},", passing the matching ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["*ComponentConfig"]},", and wire weak references where required (see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/card/about-configuration"},"children":["About configuration"]},")."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Render in SwiftUI with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["component.buildContent()"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"before-you-start","__idx":2},"children":["Before you start"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PXPCheckoutSDK"]}," to your app. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/install"},"children":["Install"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You'll need a session from your server (session ID, HMAC key, and encryption key) and a merchant shopper ID that matches your backend model."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-1-initialise-the-sdk","__idx":3},"children":["Step 1: Initialise the SDK"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpCheckout.initialize(config:)"]}," with a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig"]},". This can ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["throw"]}," if mandatory fields are missing or inconsistent."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import PXPCheckoutSDK\n\nlet sessionData = SessionData(\n    sessionId: \"your-session-id\",\n    hmacKey: \"your-hmac-key\",\n    encryptionKey: \"your-encryption-key\"\n)\n\nlet transactionData = TransactionData(\n    amount: 10,\n    currency: \"USD\",\n    entryType: .ecom,\n    intent: TransactionIntentData(card: .authorisation),\n    merchantTransactionId: \"unique-transaction-id\",\n    merchantTransactionDate: { Date() }\n)\n\nlet checkoutConfig = CheckoutConfig(\n    environment: .test,\n    session: sessionData,\n    transactionData: transactionData,\n    merchantShopperId: \"shopper-id\",\n    ownerType: \"MerchantGroup\",\n    ownerId: \"your-owner-id\",\n    onGetShopper: { async in TransactionShopper(id: \"shopper-id\") },\n    analyticsEvent: { event in\n        _ = event.eventName\n    }\n)\n\nlet pxpCheckout = try PxpCheckout.initialize(config: checkoutConfig)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following table describes the main properties in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig"]},":"]},{"$$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":"30%","data-label":"Property"},"children":["Property "]},{"$$mdtype":"Tag","name":"th","attributes":{"width":"70%","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":["environment"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Environment"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The environment type.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".test"]},": For development and testing."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".live"]},": For live transactions."]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["session"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["SessionData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Details about the checkout session returned from the Unity Sessions API. Includes ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sessionId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["hmacKey"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["encryptionKey"]},", and optional ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowedFundingTypes"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TransactionData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Details about the transaction. See the properties below for required fields."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.amount"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Decimal"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The transaction amount. Must match the currency's expected decimal places."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.currency"]},{"$$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 currency code associated with the transaction, in ISO 4217 format. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/supported-currencies"},"children":["Supported payment currencies"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.entryType"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["EntryType"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The entry type.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".ecom"]},": E-commerce transactions."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".moto"]},": Mail order/telephone order transactions."]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.intent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TransactionIntentData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The transaction intents for each payment method. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/card/how-it-works#supported-transaction-intents"},"children":["Supported transaction intents"]}," for details."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.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":["A unique identifier for this transaction. Use a UUID or order ID."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.merchantTransactionDate"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["() -> Date"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A function that returns the current date and time."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.recurring"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["RecurringType?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional recurring payment data (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["frequencyInDays"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["frequencyExpiration"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.linkId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional link identifier for related transactions."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.cardAcceptorName"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional card acceptor name for the transaction."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["merchantShopperId"]},{"$$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 unique identifier for the shopper in your system. Used for card tokenisation and Card-on-File functionality."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ownerType"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Always set to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"MerchantGroup\""]}," for most integrations. Required for token and some API flows."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ownerId"]},{"$$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 merchant or merchant group identifier, as assigned by PXP. You can find it in the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://portal.pxp.io","target":"_blank"},"children":["Unity Portal"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["localisation"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Localisation?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional UI string overrides for customising displayed text."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["locale"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional locale code in BCP 47 format (for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["en-GB"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayPalConfig?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["PayPal-specific settings when you use PayPal components."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["restrictions"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Restrictions?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional card restrictions for owner types and funding sources. When both session and config restrictions are provided, they are merged as a union (session values first, then config values not already present). See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#card-restrictions"},"children":["Card restrictions"]}," for details."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kountDisabled"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Bool"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether to disable Kount fraud detection. Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShippingAddress"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["() async -> ShippingAddress?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["async"]}," closure returning shipping address information. Used for pre-filling billing address from shipping address."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["() async -> TransactionShopper?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["async"]}," closure returning shopper information. Required for card tokenisation and Card-on-File functionality. Returns shopper object containing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["firstName"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lastName"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["analyticsEvent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["(BaseAnalyticsEvent) -> Void"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional analytics callback. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/card/analytics"},"children":["Analytics"]}," for details."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.recurring"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"transactionData: TransactionData(\n    // ...\n    recurring: RecurringType(frequencyInDays: 30, frequencyExpiration: \"2025-01-01\")\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"supported-card-transaction-intents","__idx":4},"children":["Supported card transaction intents"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.intent.card"]}," property accepts the following intent types:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Intent"},"children":["Intent"]},{"$$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":[".authorisation"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Reserve funds on the customer's payment method (capture later). The default for most payment flows. Use when you need to hold funds temporarily, for example pending order shipment."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".purchase"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Capture funds immediately after authorisation. Use for instant-fulfilment transactions like digital goods or instant services."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".verification"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Verify that a card is legitimate and active, without reserving any funds or completing a purchase. Use for validating payment methods during customer onboarding."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".estimatedAuthorisation"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Reserve funds on the customer's payment method, based on an estimated amount. The final amount is confirmed at capture time. Use in environments like hotels, car rental agencies, or fuel stations where the final charge may vary."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".payout"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Send funds to the cardholder's card (also called disbursement or withdrawal). Use for marketplace seller payments, insurance settlements, refunds, or prize distributions. Funds move from your merchant account to the recipient's card."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"card-restrictions","__idx":5},"children":["Card restrictions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can restrict which cards are accepted based on owner type (corporate or consumer) and funding source (credit, debit, or prepaid). Restrictions can be set in two places:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Session-level"]},": returned from the backend in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SessionData.restrictions"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Config-level"]},": passed directly to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig.restrictions"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When both are provided, they're merged as a union (session values first, then config values not already present)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"structure","__idx":6},"children":["Structure"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let restrictions = Restrictions(\n    card: Restrictions.Card(\n        ownerTypes: [.corporate, .consumer],    // Optional\n        fundingSources: [.credit, .debit]       // Optional\n    )\n)\n\nlet checkoutConfig = CheckoutConfig(\n    // ... other parameters\n    restrictions: restrictions\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"owner-types","__idx":7},"children":["Owner types"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".corporate"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Corporate/business cards"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".consumer"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Consumer/personal cards"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"funding-sources","__idx":8},"children":["Funding sources"]},{"$$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":"Value"},"children":["Value"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".credit"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Credit cards"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".debit"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Debit cards"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".prepaid"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Prepaid cards"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-accept-only-consumer-credit-and-debit-cards","__idx":9},"children":["Example: Accept only consumer credit and debit cards"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let checkoutConfig = CheckoutConfig(\n    environment: .test,\n    session: sessionData,\n    transactionData: transactionData,\n    merchantShopperId: \"shopper-id\",\n    ownerId: \"your-owner-id\",\n    restrictions: Restrictions(\n        card: Restrictions.Card(\n            ownerTypes: [.consumer],\n            fundingSources: [.credit, .debit]\n        )\n    )\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ownerTypes"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fundingSources"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nil"]},", no restriction is applied for that dimension. Setting both to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nil"]}," means all cards are accepted."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-2-create-a-component","__idx":10},"children":["Step 2: Create a component"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["try pxpCheckout.create(componentType, componentConfig:)"]},". Cast the returned ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseComponent"]}," to the concrete type when you need ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["buildContent()"]}," or submit APIs."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let config = NewCardComponentConfig(/* … */)\nguard let newCard = try pxpCheckout.create(.newCard, componentConfig: config) as? NewCardComponent else {\n    throw /* or handle configuration error */\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Accordion","attributes":{"title":"ComponentType values (card-related)","defaultOpen":false},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Pre-built"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".newCard"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".billingAddress"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cardOnFile"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".clickOnce"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".clickOnceStandalone"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Standalone"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cardNumber"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cardExpiryDate"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cardCvc"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cardHolderName"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cardBrandSelector"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cardConsent"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".dynamicCardImage"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cardSubmit"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".countrySelection"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".postcode"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".address"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".prefillBillingAddressCheckbox"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Other (non-card) types exist on the same enum (PayPal, Apple Pay, and so on)."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-3-render-the-component","__idx":11},"children":["Step 3: Render the component"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Embed ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["buildContent()"]}," in your SwiftUI hierarchy. For ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CardSubmitComponent"]},", submit collects data through weak references on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CardSubmitComponentConfig"]},":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Pre-built ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".newCard"]},"* field refs are wired internally; merchants only pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["submit"]}," inside ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NewCardComponentConfig"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Standalone ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cardSubmit"]},": assign weak refs before render/submit, e.g.,",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["newCardComponent"]}," when reusing a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NewCardComponent"]}," with a separate submit button, ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["or"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardNumberComponent"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardExpiryDateComponent"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardCvcComponent"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardHolderNameComponent"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardConsentComponent"]}," for fully standalone fields."]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/card/about-configuration"},"children":["About configuration"]}," for the full weak-reference matrix."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import SwiftUI\n\nstruct PaymentScreen: View {\n    let newCard: NewCardComponent\n\n    var body: some View {\n        ScrollView {\n            VStack(alignment: .leading, spacing: 16) {\n                Text(\"Payment\")\n                    .font(.title2)\n                newCard.buildContent()\n            }\n            .padding()\n        }\n    }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-4-view-and-session-lifetime","__idx":12},"children":["Step 4: View and session lifetime"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Hold ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpCheckout"]}," for as long as the checkout session is valid (typically the lifetime of your payment screen or a coordinator you inject)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Recreate ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PxpCheckout"]}," when you start a new server session (new ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SessionData"]},"), not on every SwiftUI body refresh."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Components are reference types; avoid recreating them unnecessarily. If you use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@State"]},", store the component instance you created after ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["initialize"]},", not a new config on every render."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["There's no public SDK ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cleanup()"]},"; dropping references when the customer leaves checkout is sufficient for typical apps."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"whats-next","__idx":13},"children":["What's next?"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"customise-appearance","__idx":14},"children":["Customise appearance"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FieldStyle"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FieldInputStateStyles"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ContainerStyle"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ButtonStateStyles"]},", and per-component configs. Each component guide lists the relevant structs — start from ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/card/new-card"},"children":["New card"]}," or ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/card/card-number"},"children":["Card number"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"var numberConfig = CardNumberComponentConfig(\n    label: \"Card number\",\n    acceptedCardBrands: [.visa, .mastercard, .amex]\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"add-event-handling","__idx":15},"children":["Add event handling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["iOS field configs use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["() -> Void"]}," for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onChange"]}," / focus, and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["([ValidationResult]) -> Void"]}," for validation callbacks (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ValidationResult.valid"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]},"). Submit lifecycle lives on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CardSubmitComponentConfig"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPreAuthorisation"]}," is required for card payment — if it's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nil"]},", submit stops silently (loading resets, no ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostAuthorisation"]},", no ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]},")."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"var fields = NewCardComponentFields()\nfields.cardNumber = CardNumberComponentConfig(\n    label: \"Card number\",\n    onCardBrandDetected: { event in\n        // CardBrandDetectionEvent: cardBrand, isCardBrandAccepted\n    },\n    onValidationFailed: { results in\n        for r in results where !r.valid {\n            r.errors?.values.forEach { print($0.code, $0.message) }\n        }\n    }\n)\n\nvar submit = CardSubmitComponentConfig()\nsubmit.onPreAuthorisation = { (preAuthData: PreAuthorizationData?) async -> TransactionInitiationData? in\n    // preAuthData?.gatewayTokenId, preAuthData?.schemeTokenId available after tokenisation\n    TransactionInitiationData(\n        psd2Data: nil,\n        riskScreeningData: nil\n    )\n}\nsubmit.onPostAuthorisation = { result in\n    if result is MerchantSubmitResult { /* success */ }\n    else if let refused = result as? RefusedSubmitResult { /* decline */ }\n    else if let failed = result as? FailedSubmitResult { /* API / transport failure */ }\n}\nsubmit.onSubmitError = { error in\n    print(error.errorCode, error.errorMessage) // BaseSdkException\n}\n\nlet newCardConfig = NewCardComponentConfig(\n    fields: fields,\n    submit: submit,\n    onValidation: { results in\n        let ok = results.allSatisfy(\\.valid)\n        // drive your own CTA state\n    }\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Details: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/card/events"},"children":["Events"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"analytics","__idx":16},"children":["Analytics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Handle ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig.analyticsEvent"]}," — pattern matching on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseAnalyticsEvent"]}," subclasses (for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentErrorAnalyticsEvent"]},"). See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/card/analytics"},"children":["Analytics"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"CheckoutConfig(\n    // …\n    analyticsEvent: { event in\n        if let err = event as? ComponentErrorAnalyticsEvent {\n            // log err.errorMessage, err.errorCode, etc.\n        }\n    }\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"error-handling","__idx":17},"children":["Error handling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["do"]},"/",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["catch"]}," around ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["initialize"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["create"]},", and downcast ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPostAuthorisation"]}," results."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"do {\n    let checkout = try PxpCheckout.initialize(config: checkoutConfig)\n    _ = checkout\n} catch {\n    // Show configuration / session error\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"complete-example-new-card","__idx":18},"children":["Complete example (new card)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Minimal SwiftUI screen: bootstrap checkout, create new card, render it. Replace placeholders with real session values and tighten error handling for production."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import SwiftUI\nimport PXPCheckoutSDK\n\n@MainActor\nfinal class NewCardPaymentModel: ObservableObject {\n    /// Keep checkout alive for the lifetime of the payment screen.\n    private var pxpCheckout: PxpCheckout?\n    @Published private(set) var newCard: NewCardComponent?\n    @Published var bootstrapError: String?\n\n    func load() {\n        bootstrapError = nil\n        do {\n            let sessionData = SessionData(\n                sessionId: \"your-session-id\",\n                hmacKey: \"your-hmac-key\",\n                encryptionKey: \"your-encryption-key\"\n            )\n            let transactionData = TransactionData(\n                amount: 10,\n                currency: \"USD\",\n                entryType: .ecom,\n                intent: TransactionIntentData(card: .authorisation),\n                merchantTransactionId: UUID().uuidString,\n                merchantTransactionDate: { Date() }\n            )\n            let checkoutConfig = CheckoutConfig(\n                environment: .test,\n                session: sessionData,\n                transactionData: transactionData,\n                merchantShopperId: \"shopper-id\",\n                ownerType: \"MerchantGroup\",\n                ownerId: \"your-owner-id\",\n                onGetShopper: { async in TransactionShopper(id: \"shopper-id\") }\n            )\n            let checkout = try PxpCheckout.initialize(config: checkoutConfig)\n            self.pxpCheckout = checkout\n\n            var submitConfig = CardSubmitComponentConfig()\n            submitConfig.onPreAuthorisation = { (preAuthData: PreAuthorizationData?) async -> TransactionInitiationData? in\n                TransactionInitiationData(\n                    psd2Data: nil,\n                    riskScreeningData: nil\n                )\n            }\n            submitConfig.onPostAuthorisation = { result in\n                if result is MerchantSubmitResult {\n                    // Go to success screen\n                } else if let refused = result as? RefusedSubmitResult {\n                    _ = refused.provider?.message\n                }\n            }\n            submitConfig.onSubmitError = { error in\n                _ = error.errorCode\n            }\n\n            var fields = NewCardComponentFields()\n            fields.cardNumber = CardNumberComponentConfig(label: \"Card number\")\n            fields.expiryDate = CardExpiryDateComponentConfig(label: \"Expiry\")\n            fields.cvc = NewCardOptionalField(\n                config: CardCvcComponentConfig(label: \"CVC\", isRequired: true),\n                isShown: true\n            )\n\n            let newCardConfig = NewCardComponentConfig(\n                fields: fields,\n                submit: submitConfig\n            )\n            newCard = try checkout.create(.newCard, componentConfig: newCardConfig) as? NewCardComponent\n        } catch {\n            bootstrapError = error.localizedDescription\n        }\n    }\n}\n\nstruct NewCardPaymentView: View {\n    @StateObject private var model = NewCardPaymentModel()\n\n    var body: some View {\n        Group {\n            if let card = model.newCard {\n                card.buildContent()\n            } else if let message = model.bootstrapError {\n                Text(message).foregroundStyle(.red)\n            } else {\n                ProgressView()\n            }\n        }\n        .padding()\n        .onAppear { model.load() }\n    }\n}\n","lang":"swift"},"children":[]}]},"headings":[{"value":"Implementation","id":"implementation","depth":1},{"value":"Overview","id":"overview","depth":2},{"value":"Before you start","id":"before-you-start","depth":2},{"value":"Step 1: Initialise the SDK","id":"step-1-initialise-the-sdk","depth":2},{"value":"Supported card transaction intents","id":"supported-card-transaction-intents","depth":3},{"value":"Card restrictions","id":"card-restrictions","depth":3},{"value":"Structure","id":"structure","depth":4},{"value":"Owner types","id":"owner-types","depth":4},{"value":"Funding sources","id":"funding-sources","depth":4},{"value":"Example: Accept only consumer credit and debit cards","id":"example-accept-only-consumer-credit-and-debit-cards","depth":4},{"value":"Step 2: Create a component","id":"step-2-create-a-component","depth":2},{"value":"Step 3: Render the component","id":"step-3-render-the-component","depth":2},{"value":"Step 4: View and session lifetime","id":"step-4-view-and-session-lifetime","depth":2},{"value":"What's next?","id":"whats-next","depth":2},{"value":"Customise appearance","id":"customise-appearance","depth":3},{"value":"Add event handling","id":"add-event-handling","depth":3},{"value":"Analytics","id":"analytics","depth":3},{"value":"Error handling","id":"error-handling","depth":3},{"value":"Complete example (new card)","id":"complete-example-new-card","depth":2}],"frontmatter":{"seo":{"title":"Implementation"}},"lastModified":"2026-06-30T11:32:34.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/ios/card/implementation","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}