{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","tabs","tab"]},"type":"markdown"},"seo":{"title":"Android SDK Integration | xMoney Documentation","description":"Integrate xMoney Payment Sheet, Payment Element, and Google Pay in Android Compose and Activity 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":"android-sdk-integration","__idx":0},"children":["Android SDK Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The xMoney Android SDK provides a drop-in Payment Sheet, an embeddable Payment Element, and standalone Google 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":["Android Gradle Plugin 8.5 or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Kotlin 2.0 or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Java 17"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["minSdk"]}," 23 and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["compileSdk"]}," 36"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A host screen based on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FragmentActivity"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A publishable xMoney key and a backend that 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":"p","attributes":{},"children":["Make sure ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mavenCentral()"]}," is configured, then add Payment Sheet:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"dependencies {\n    implementation(\"com.xmoney:paymentsheet:1.0.0\")\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Payment Sheet brings in Payment Element and Google Pay at runtime. To choose surfaces separately:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"dependencies {\n    implementation(\"com.xmoney:paymentelement:1.0.0\")\n    implementation(\"com.xmoney:googlepay:1.0.0\")\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Payment Element does not include the Google Pay module automatically."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-create-a-paymentintent","__idx":3},"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":"kotlin","header":{"controls":{"copy":{}}},"source":"val intent = PaymentIntent(\n    OrderPayload(payloadFromYourServer),\n    OrderChecksum(checksumFromYourServer),\n)\n","lang":"kotlin"},"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":4},"children":["3. Choose a payment surface"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"payment-sheet","__idx":5},"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":"Compose","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val sheet = rememberPaymentSheet(\n    configuration = PaymentConfig(\n        publicKey = \"pk_test_...\",\n        paymentMethods = PaymentMethodsConfig(\n            googlePay = GooglePayConfig(enabled = true),\n        ),\n        card = CardConfig(\n            savedCards = SavedCardsConfig(enabled = true),\n        ),\n    ),\n    onResult = ::handlePaymentResult,\n)\n\nsheet.present(intent) { event ->\n    if (event is PaymentSheetEvent.Ready) {\n        hideCheckoutLoader()\n    }\n}\n","lang":"kotlin"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Activity","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val sheet = PaymentSheet(configuration)\n\nsheet.present(\n    activity = this,\n    intent = intent,\n    onEvent = { event ->\n        if (event is PaymentSheetEvent.Ready) {\n            hideCheckoutLoader()\n        }\n    },\n    onResult = ::handlePaymentResult,\n)\n","lang":"kotlin"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Idle close, back, 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":6},"children":["Payment Element"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Payment Element places the form in your Compose layout. Keep it composed while it binds the order."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"var ready by remember { mutableStateOf(false) }\n\nval embedded = rememberEmbeddedPayment(\n    configuration = configuration,\n    onResult = ::handlePaymentResult,\n)\n\nif (!ready) {\n    CheckoutLoader()\n}\n\nPaymentElement(\n    controller = embedded,\n    intent = intent,\n    modifier = Modifier.padding(horizontal = 20.dp),\n    onEvent = { event ->\n        if (event is EmbeddedEvent.Ready) {\n            ready = true\n        }\n    },\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Payment Element supplies no outer page padding or background. Keep it mounted, and apply spacing and surrounding layout in your app."]},{"$$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 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Ready"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val configuration = PaymentConfig(\n    publicKey = \"pk_test_...\",\n    card = CardConfig(\n        submitButton = SubmitButtonConfig(visible = false),\n    ),\n)\n\nButton(\n    onClick = { embedded.confirm() },\n    enabled = embedded.isInteractionEnabled,\n) {\n    Text(\"Pay\")\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"standalone-google-pay","__idx":7},"children":["Standalone Google Pay"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val googlePay = rememberGooglePay(\n    configuration = configuration,\n    onResult = ::handlePaymentResult,\n)\n\nGooglePayButton(\n    controller = googlePay,\n    intent = intent,\n    onEvent = { event ->\n        if (event is GooglePayEvent.Ready) {\n            hideWalletLoader()\n        }\n    },\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isAvailable"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isReady"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isInteractionEnabled"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isOrderConsumed"]}," to control surrounding wallet UI. For Activity integrations, call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GooglePay.availability(activity, intent)"]}," before ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["present"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A wallet dismissal before authorization returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Canceled"]}," and does not consume the intent."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/payments/payment-methods/google-pay"},"children":["Google Pay"]}," for activation and integration options."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"handle-paymentresult","__idx":8},"children":["Handle PaymentResult"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"fun handlePaymentResult(result: PaymentResult) {\n    when (result) {\n        is PaymentResult.Complete -> confirmOrderOnBackend(result.transaction)\n        is PaymentResult.Failed -> showPaymentError(result.error.message)\n        PaymentResult.Canceled -> showCheckout()\n    }\n}\n","lang":"kotlin"},"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":9},"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":"kotlin","header":{"controls":{"copy":{}}},"source":"embedded.updateOrder(\n    PaymentIntent(\n        OrderPayload(nextPayload),\n        OrderChecksum(nextChecksum),\n    ),\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Changing the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["intent"]}," passed to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentElement"]}," also updates the order. Do not unmount the element for a loader. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isInteractionEnabled"]}," remains false until the new intent is ready."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For live styling changes, keep the controller and call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["updateAppearance"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["updateStyle"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["updateLocale"]},", or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["updateWalletAppearance"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configuration","__idx":10},"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":"kotlin","header":{"controls":{"copy":{}}},"source":"val configuration = PaymentConfig(\n    publicKey = \"pk_test_...\",\n    card = CardConfig(\n        savedCards = SavedCardsConfig(\n            enabled = true,\n            optInVisible = true,\n        ),\n        validationMode = ValidationMode.ON_TOUCHED,\n        inputs = CardInputsConfig(\n            grouping = CardGrouping.CONDENSED,\n        ),\n    ),\n    options = OptionsConfig(\n        locale = \"en-US\",\n        style = UserInterfaceStyle.AUTOMATIC,\n    ),\n)\n","lang":"kotlin"},"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"]}," and return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," to continue:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"card = CardConfig(\n    cardHolderVerification = CardHolderVerification(\n        name = CardHolderName(\n            firstName = \"John\",\n            lastName = \"Doe\",\n        ),\n        onCardHolderVerification = { result ->\n            result.status == CardHolderMatchStatus.MATCHED\n        },\n    ),\n)\n","lang":"kotlin"},"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":11},"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-android/tree/main/example"},"children":["Android SDK samples"]},"."]}]}]},"headings":[{"value":"Android SDK Integration","id":"android-sdk-integration","depth":1},{"value":"Requirements","id":"requirements","depth":2},{"value":"1. Install the SDK","id":"1-install-the-sdk","depth":2},{"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 Google Pay","id":"standalone-google-pay","depth":3},{"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":"Android SDK Integration | xMoney Documentation","description":"Integrate xMoney Payment Sheet, Payment Element, and Google Pay in Android Compose and Activity apps."}},"lastModified":"2026-09-10T09:47:36.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/native-sdks/android","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}