{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","tabs","tab"]},"type":"markdown"},"seo":{"title":"iOS SDK Integration | xMoney Documentation","description":"Integrate xMoney Payment Sheet, Payment Element, and Apple Pay in UIKit and SwiftUI apps.","llmstxt":{"hide":false,"title":"xMoney Documentation","description":"Guides and API references for integrating xMoney card and crypto payments.","sections":[{"title":"Guides","description":"Integration guides for card payments, crypto, checkout, and dashboard.","includeFiles":["guides/**/*.md"]},{"title":"Card API","description":"REST API reference and concepts for xMoney card payments.","includeFiles":["api/**/*.md","api/**/*.yaml"]},{"title":"Crypto API","description":"REST API reference and concepts for xMoney crypto payments.","includeFiles":["crypto_api/**/*.md","crypto_api/**/*.yaml"]},{"title":"Card Issuing API","description":"Guides and API reference for xMoney whitelabel card issuing partners.","includeFiles":["card_issuing_api/**/*.md","card_issuing_api/**/*.yaml"]}]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"ios-sdk-integration","__idx":0},"children":["iOS SDK Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The xMoney iOS SDK provides a drop-in Payment Sheet, an embeddable Payment Element, and standalone Apple Pay. All surfaces use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentConfig"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentIntent"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentResult"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Current release: ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1.0.0"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"requirements","__idx":1},"children":["Requirements"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["iOS 15 or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Swift 5.9 or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Xcode 15 or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A publishable xMoney key"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A backend that creates and signs orders"]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Do not ship a secret key"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Store the xMoney private key on your backend. The app should receive only the publishable key, order payload, and checksum."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-install-the-sdk","__idx":2},"children":["1. Install the SDK"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"swift-package-manager","__idx":3},"children":["Swift Package Manager"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the package dependency:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":".package(\n    url: \"https://github.com/xMoney-Payments/xmoney-ios.git\",\n    from: \"1.0.0\"\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Link ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["XMoneyPaymentSheet"]}," for Payment Sheet. It includes Payment Element and Apple Pay. For a smaller embedded integration, link ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["XMoneyPaymentElement"]}," and add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["XMoneyApplePay"]}," only when you need Apple Pay."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"cocoapods","__idx":4},"children":["CocoaPods"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"pod 'XMoneyPaymentSheet', '1.0.0'\n\n# Or select individual surfaces:\n# pod 'XMoneyPaymentSheet', :subspecs => ['PaymentElement']\n# pod 'XMoneyPaymentSheet', :subspecs => ['ApplePay']\n","lang":"ruby"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["CocoaPods exposes all subspecs through ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["import XMoneyPaymentSheet"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-create-a-paymentintent","__idx":5},"children":["2. Create a PaymentIntent"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your backend creates and signs the order. Build an intent from the returned values:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let intent = PaymentIntent(\n    orderPayload: OrderPayload(payloadFromYourServer),\n    orderChecksum: OrderChecksum(checksumFromYourServer)\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/inline-checkout/web-integration#3-create-the-order-on-your-backend"},"children":["Create the order on your backend"]}," for the shared server responsibilities."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"3-choose-a-payment-surface","__idx":6},"children":["3. Choose a payment surface"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"payment-sheet","__idx":7},"children":["Payment Sheet"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Payment Sheet owns the complete checkout UI and Pay button."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"UIKit","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import XMoneyPaymentSheet\n\nlet configuration = PaymentConfig(\n    publicKey: \"pk_test_...\",\n    paymentMethods: .init(\n        applePay: .init(enabled: true)\n    ),\n    card: .init(\n        savedCards: .init(enabled: true)\n    )\n)\n\nlet sheet = PaymentSheet(configuration: configuration)\n\nsheet.present(from: self, intent: intent) { result in\n    handlePaymentResult(result)\n}\n","lang":"swift"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"SwiftUI","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"Button(\"Pay\") {\n    showSheet = true\n}\n.paymentSheet(\n    isPresented: $showSheet,\n    configuration: configuration,\n    intent: intent\n) { result in\n    handlePaymentResult(result)\n}\n","lang":"swift"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Idle close, drag, or scrim dismissal returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".canceled"]}," without consuming the order. Once payment or 3DS starts, terminal results consume the signed order."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"payment-element","__idx":8},"children":["Payment Element"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Payment Element places the payment form directly in your layout. It does not link Apple Pay automatically."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import XMoneyPaymentElement\nimport XMoneyApplePay\n\nApplePay.register()\n\nlet embedded = EmbeddedPayment(configuration: configuration) { result in\n    handlePaymentResult(result)\n}\n\nlet element = PaymentElement(payment: embedded) { event in\n    if case .ready = event {\n        hideCheckoutLoader()\n    }\n}\n\nview.addSubview(element)\ntry await element.prepare(intent: intent)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ApplePay.register()"]}," before ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prepare"]}," when the embedded configuration enables Apple Pay. Keep the element mounted while it prepares and while the order changes."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To use your own Pay button, hide the SDK button and call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["confirm()"]}," after the element reports ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".ready"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let configuration = PaymentConfig(\n    publicKey: \"pk_test_...\",\n    card: .init(\n        submitButton: .init(visible: false)\n    )\n)\n\nembedded.confirm()\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Gate the merchant button with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["embedded.isInteractionEnabled"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"standalone-apple-pay","__idx":9},"children":["Standalone Apple Pay"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import XMoneyApplePay\n\nlet applePay = ApplePay(configuration: configuration) { result in\n    handlePaymentResult(result)\n}\n\napplePay.present(from: self, intent: intent)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also attach ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["present"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ApplePayButton"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ApplePayButtonView"]},". A dismissal before wallet authorization returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".canceled"]}," and does not consume the intent."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"apple-pay-setup","__idx":10},"children":["Apple Pay setup"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enable Apple Pay in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paymentMethods.applePay"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Create a Merchant ID in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developer.apple.com/account/resources/identifiers/list/merchant"},"children":["Apple Developer portal"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In Xcode, add the Apple Pay capability to your app target and select the Merchant ID."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Make sure the Merchant ID matches the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["merchantId"]}," configured for your xMoney site."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Test on a physical device with an eligible card in Wallet."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/payments/payment-methods/apple-pay"},"children":["Apple Pay"]}," for activation and integration options."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"handle-paymentresult","__idx":11},"children":["Handle PaymentResult"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"func handlePaymentResult(_ result: PaymentResult) {\n    switch result {\n    case .complete(let transaction):\n        confirmOrderOnBackend(transaction)\n    case .failed(let error):\n        showPaymentError(error.message)\n    case .canceled:\n        showCheckout()\n    }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the result to update the app, then confirm final payment status on your backend before fulfillment."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"update-a-mounted-payment-element","__idx":12},"children":["Update a mounted Payment Element"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When the amount, currency, or cart changes, request a new signed order and rebind the mounted element:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"try await embedded.updateOrder(intent: nextIntent)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Do not replace the element with a loader. Interaction is disabled until the new intent is ready. A complete, failed, or post-submit canceled result consumes the current intent; prepare a new one before another attempt."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configuration","__idx":13},"children":["Configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentConfig"]}," controls saved cards, card validation, field grouping, submit-button intent, locale, light/dark style, colors, and radii."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let configuration = PaymentConfig(\n    publicKey: \"pk_test_...\",\n    card: .init(\n        savedCards: .init(enabled: true, optInVisible: true),\n        validationMode: .onTouched,\n        inputs: .init(grouping: .condensed)\n    ),\n    options: .init(\n        locale: \"en-US\",\n        style: .automatic\n    )\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Supported UI languages are English (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["en"]},"), Greek (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["el"]},"), Romanian (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ro"]},"), Bulgarian (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bg"]},"), Hungarian (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["hu"]},"), and Polish (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pl"]},"). Region tags such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pl-PL"]}," are supported."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For cardholder name verification, provide ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CardHolderVerification"]}," in the card configuration and return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," to continue:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"card: .init(\n    cardHolderVerification: CardHolderVerification(\n        name: CardHolderName(firstName: \"John\", lastName: \"Doe\"),\n        onCardHolderVerification: { result in\n            result.status == .matched\n        }\n    )\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The site must have cardholder name verification enabled."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"next-steps","__idx":14},"children":["Next steps"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Review the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/native-sdks"},"children":["native SDK shared model"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/payments/testing"},"children":["test cards"]}," in the test environment."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Explore the complete ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/xMoney-Payments/xmoney-ios/tree/main/Examples"},"children":["iOS SDK samples"]},"."]}]}]},"headings":[{"value":"iOS SDK Integration","id":"ios-sdk-integration","depth":1},{"value":"Requirements","id":"requirements","depth":2},{"value":"1. Install the SDK","id":"1-install-the-sdk","depth":2},{"value":"Swift Package Manager","id":"swift-package-manager","depth":3},{"value":"CocoaPods","id":"cocoapods","depth":3},{"value":"2. Create a PaymentIntent","id":"2-create-a-paymentintent","depth":2},{"value":"3. Choose a payment surface","id":"3-choose-a-payment-surface","depth":2},{"value":"Payment Sheet","id":"payment-sheet","depth":3},{"value":"Payment Element","id":"payment-element","depth":3},{"value":"Standalone Apple Pay","id":"standalone-apple-pay","depth":3},{"value":"Apple Pay setup","id":"apple-pay-setup","depth":2},{"value":"Handle PaymentResult","id":"handle-paymentresult","depth":2},{"value":"Update a mounted Payment Element","id":"update-a-mounted-payment-element","depth":2},{"value":"Configuration","id":"configuration","depth":2},{"value":"Next steps","id":"next-steps","depth":2}],"frontmatter":{"seo":{"title":"iOS SDK Integration | xMoney Documentation","description":"Integrate xMoney Payment Sheet, Payment Element, and Apple Pay in UIKit and SwiftUI apps."}},"lastModified":"2026-09-10T09:47:36.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/native-sdks/ios","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}