Skip to Content
Docs

Android SDK

Take card, redirect, and Google Pay payments in an Android app, with SDK-owned card fields, 3DS in a WebView, a headless checkout API, and a drop-in.

The Pay.com Android SDK is a headless checkout for native apps, with the same API shape as the iOS SDK, and a ready-made drop-in. Your server creates a session, the app starts a checkout with the session's client_secret, and the SDK takes the payment:

  • Card fields the SDK owns. Compose fields, with View versions, driven by a PayCardController. The app never reads the card number. It sees only validation state, the card brand, and the first 8 digits.
  • 3DS handled for you. When the issuer asks for a challenge, the SDK shows it in a full-screen WebView dialog over your activity, then reads the outcome.
  • Redirect payment methods. Alternative payment methods open in a Custom Tab and come back to your app through a return URL.
  • Google Pay. Google's sheet over your activity, with Pay.com decrypting the token.
  • A drop-in. A Material 3 payment sheet with the session's methods, the card form, Google Pay, and the Pay button.
  • Saved methods and payout methods. At checkout, the customer can pay with one of their saved methods, such as a card, a PayPal account, or a bank account. In a payout setup session, the customer being paid picks a saved payout method or adds one.
  • Coroutines. create, pay, payWithGooglePay, and the drop-in's present are suspend functions.

The drop-in for a new customer, and for a returning one:

Illustration of the Android drop-in for a new customer: Example shop and €24.90 with Close, a Google Pay button, "or", a Pay with list with Card selected by radio, PayPal, and iDEAL, each with its logo, outlined card fields, and a Pay €24.90 button with the accepted card brands under it.Illustration of the Android drop-in for a returning customer: Example shop and €24.90 with Close, a Google Pay button, "or", a carousel with a large Visa card and the next methods cropped beside it, Visa ending in 4242 with Default and a Change button, and a Pay €24.90 button.

Requirements

The SDK needs these platform versions and libraries.

RequirementVersion
AndroidminSdk 24 (Android 7.0), with the libraries compiled against SDK 35
Kotlin2.2
Java bytecode11
UIJetpack Compose and Material 3 for the card fields and the drop-in, with View versions of the card fields for apps that don't use Compose
Google PayGoogle Play services Wallet 19.4, which pay-googlepay brings in

Install

The SDK is split into seven modules, with the Maven coordinates com.pay.sdk:<module>:0.1.0.

ModuleTypeWhat it contains
pay-coreKotlin/JVMPayCheckout, the models, PayError, PayResult, card validation, and the payment flow.
pay-elementsAndroid libraryThe card fields (PayCardNumberField, PayExpiryField, PayCvcField, PayNameField) driven by a PayCardController, a saved card's CVV field driven by a PayCvcController, and their View versions. Brings in pay-core.
pay-threedsAndroid librarycheckout.pay(request, activity), the 3DS challenge WebView, and the Custom Tabs redirects. Brings in pay-core.
pay-googlepayAndroid libraryGoogle Pay (PayGooglePay.isReadyToPay() and checkout.payWithGooglePay()). Brings in pay-threeds and Google's play-services-wallet.
pay-dropinAndroid libraryPayDropIn, a ready-made payment sheet with the session's methods, a returning customer's saved methods, the card form, Google Pay, the save-card switch, the Pay button, errors, and retries. Brings in pay-elements, pay-threeds, and pay-googlepay.
pay-cseKotlin/JVMClient-side encryption (PayCSE) of a card or a CVV. pay-core uses it for clientSideEncryption. Depend on it to encrypt cards from your own form. See Client-side encryption on mobile.
pay-linkoutAndroid libraryPayLinkOut opens a checkout your server created in the browser when the store's rules allow it and reports how the customer came back. Standalone module with no SDK dependencies.

For the drop-in, depend on pay-dropin:

dependencies {
    implementation("com.pay.sdk:pay-dropin:0.1.0")
}

For your own UI, most apps depend on pay-elements and pay-threeds, and add pay-googlepay for Google Pay:

dependencies {
    implementation("com.pay.sdk:pay-elements:0.1.0")
    implementation("com.pay.sdk:pay-threeds:0.1.0")
}

The modules aren't on a public Maven repository yet.

How a payment works

A payment runs in four steps across your server and the app.

  1. Your server creates a payment session with Create a payment session and sends only its client_secret to the app.
  2. The app calls PayCheckout.create() with that client_secret.
  3. The app shows the session's payment methods and the card fields, and calls checkout.pay() when the customer pays. Or it presents the drop-in, which does both. The SDK sends the card to Pay.com, runs 3DS when the session asks for it, and shows any challenge or redirect.
  4. The app gets a PayResult. Treat it as a hint for your UI. Your server confirms the payment with Retrieve a payment session or the payment_session.completed webhook before it fulfills the order. For a setup session, it uses Retrieve a setup session or the setup_session.completed webhook.
Was this page helpful?