Skip to main content

Android SDK

The Android SDK is the native counterpart of the web Headless Checkout: the same concepts (client session, payment methods, primary and secondary methods, split, submit) in Kotlin and Jetpack Compose. You build the checkout screen; the SDK exposes the session's payment methods as reactive state, renders each method's own step (a secure card form, Google Pay's button, Klarna's widget, a PSP page) and drives the payment to its outcome.

How it works​

Key characteristics​

AspectDetail
IntegrationStateFlow for methods, tokens, amounts and session state; one composable, rememberPaymentElement, renders any method
UI controlYou build the whole checkout screen; the SDK renders only each method's own step
Payment methodsCard (Purse vault), Google Pay, PayPal, Klarna, every redirection method the session offers, gift cards, saved cards and saved PayPal accounts, BNPL instalment simulation
ComplianceCard data is captured by the embedded Android Secure Fields and never reaches your code
DistributionMaven Central, group eu.purse: one SDK artifact plus one optional artifact per partner SDK
Web paritySame session, same /init and /validate contract, same error codes and method states as the web SDK

Artifacts​

ArtifactContentsAdd it when
eu.purse:headless-checkout-androidEngine, payment elements, card and redirection methods, gift cards, saved methodsAlways
eu.purse:headless-checkout-googlepayGoogle Pay plugin and Play Services WalletYou offer Google Pay
eu.purse:headless-checkout-klarnaKlarna plugin and the Klarna Mobile SDKYou offer Klarna
eu.purse:headless-checkout-paypalPayPal plugin and the PayPal Android SDKYou offer PayPal

A merchant offering cards only embeds none of the partner SDKs. A partner artifact registers its payment method by itself once it is on the classpath; the four artifacts release together and share one version number. What each partner needs from your project is on its own page under Payment methods.

Requirements​

RequirementValue
Minimum Android SDK26 (Android 8.0)
Compile SDK37
Kotlin2.x; the SDK is compiled with Kotlin 2.4.20, use the same version or later
UIJetpack Compose (a View-based screen hosts the payment element in a ComposeView)
Client sessionCreated by your backend with the Purse API; the app receives its widget.data string

When to use this SDK​

ScenarioRecommendation
Native Android checkout with your own design✅ Android SDK
Web checkout with your own designHeadless Checkout (web)
Collect card data only and pay server-sideAndroid Secure Fields
Fastest integration, standard checkoutDrop-in Checkout in a web view, or Hosted Page

What you build vs. what the SDK handles​

  • Decoding the client session and listing what it offers
  • Each method's own step: secure card form, wallet sheet or button, Klarna widget, PSP page
  • /init and /validate calls, 3-D Secure and redirect returns
  • Amount split between a primary method and gift cards
  • Saved cards and accounts, wallet management, BNPL simulation
  • Refusing a double submit, an expired or an already paid session
  • Snapshot and restore across process death (saveState / restore)

How this documentation is organized​

Like the other Purse SDKs, this section follows the Diátaxis framework: each page is one of four kinds, and never mixes them.

KindRead it toPages
TutorialLearn by doingGetting started: a card payment in sandbox from an empty project
How-to guidesSolve one taskPayment methods, one guide per method · Advanced guides · Error handling · Run the sample app
ReferenceLook something upSDK reference · Error codes · Method states · Supported payment methods · Changelog
ExplanationUnderstand the modelThis page · Key concepts

The generated KDoc reference of every public declaration ships with each release and as the javadoc jar your IDE reads from Maven Central.

Known limitations​

  • Purse 3-D Secure is not supported yet. Card payments are authenticated only by the PSP's own 3-D Secure, which the SDK presents as a redirection. 3-D Secure run by Purse, as the Web SDK does with threeDSChallenge, has no equivalent in this SDK.

Next steps​