This sample app demonstrates the Spreedly Android Checkout SDK at version 1.6.0 (tag v1.6.0).
- Clone this repository
- Add your GitHub Packages credentials to
~/.gradle/gradle.properties:
gpr.usr=YOUR_GITHUB_USERNAME
gpr.key=YOUR_GITHUB_TOKEN- Add your Spreedly environment key and other API keys to
apikeys.properties(seeapikeys.properties.example) demoBackendUrlnear the top ofapp/build.gradle.ktspoints at Spreedly's sample backend (https://checkout.spreedly-demo.app) by default. That host uses HTTP Basic auth — setbackendBasicAuthUserandbackendBasicAuthPasswordinapikeys.propertieswhen your team provides them (Demo backend). Basic auth is sent only on HTTPS to that configured origin, not to other hosts or plain-HTTP local backends, using UTF-8 encoding in theAuthorizationheader. Values compile into debug builds only. When you changedemoBackendUrlto your own host (for examplehttps://backend.example.com), purchase JSON includesredirect_urlagain (omission applies only to the exact HTTPS origin of the default hosted sample). Gradle turns the omit flag off by default for a custom host; if you forcespreedlyOmitRedirectUrl=trueinapikeys.properties, omission still does not apply unless the request targets that hosted origin. On the canonical hosted default URL only, the app may omitredirect_url, stores saved cards on the device, and tags tokenization withsample_app_ownerfor retain ownership. Any otherdemoBackendUrl(other host, path prefix, or port) uses custom mode:GET /api/v1/payment_methodssync, legacy retain (success: true), no ownership metadata. Saved cards are scoped per backend URL andenvironmentKey; custom-backend upgrades hide unscoped local cards untilGET /api/v1/payment_methodssucceeds on the relevant demo screens (Basic Form, recache flows, and Java examples; offline mock seeding runs only on the hosted sample and is skipped on custom backends, including after a successful empty list sync). Delete on a custom backend only removes the card from the demo list (local suppression; no backend delete API; up to 20 visible cards after hide). Hosted sample owner and saved-card storage are excluded from Android cloud backup and device-to-device transfer (see the demo-backend section in the testing guide). Endpoint shapes are in the same guide.- Open the project in Android Studio and sync Gradle
Secure tokenization: This sample fetches its nonce, signature, and certificate token from the backend at
demoBackendUrl(AuthService). That backend must sign with the certificate private key of the environment key inapikeys.properties: once Enable secure tokenization (Environment settings → Security → Enhanced Security, in app.spreedly.com) is on, a signature from any other certificate fails its check, and a certificate never authorizes a different organization's environment (nor, by default, a different environment at all — certificates are scoped to one environment unless created with organization-level scope). Never leave secure tokenization disabled on a production environment. It's still required there. For your own app, replaceAuthServicewith a backend that signs with your own certificate — see the SDK docs' Getting Started guide for the full steps.
All SDK modules are resolved from GitHub Packages:
implementation("com.spreedly:checkout-paymentsheet:1.6.0")
implementation("com.spreedly:checkout-braintree-apm:1.6.0")
implementation("com.spreedly:checkout-stripe-apm:1.6.0")
implementation("com.spreedly:checkout-threeds:1.6.0")
implementation("com.spreedly:checkout-stripe-radar:1.6.0")
implementation("com.spreedly:checkout-clicktopay:1.6.0")Card payments —
checkout-payments-coreis always required. Usecheckout-paymentsheetfor the pre-built bottom sheet (expressCheckout()). Usecheckout-hostedfieldsfor custom forms withSPLTextField(also included transitively bycheckout-paymentsheet).
3D Secure — Add
checkout-threedsonly for Global or Gateway-Specific 3DS. It pulls the Forter SDK transitively, so add the Forter Maven repository (with credentials) whenever you depend oncheckout-threeds. See Global 3DS — Step 1.
APM, Radar & wallets — Add
checkout-braintree-apm,checkout-stripe-apm,checkout-stripe-radar,checkout-clicktopayand/orcheckout-googlepayonly when you need those payment methods, fraud sessions or wallets. See their prerequisites under Compatibility below.
Required: Generating auth details on your backend is not enough. Enable secure tokenization for each Spreedly environment in app.spreedly.com before production tokenization. Full steps, payment-method submission notes, staging checks, and platform behavior: Enable secure tokenization (required).
| Component | Minimum | Recommended |
|---|---|---|
| Android API Level | 26 (Android 8.0) | 35 (Android 15) |
| Compile SDK | 36 | 36 |
| JDK | 17 | 21 |
| Kotlin | 2.1.20 | 2.1.20 |
| Android Gradle Plugin | 8.13.2 | 8.13.2 |
| KSP | 2.1.20-2.0.1 | 2.1.20-2.0.1 |
| Gradle | 8.14.3 | 8.14.3 |
| Android Studio | Narwhal | Narwhal Feature Drop 2 |
SDK libraries target JVM 17. JDK 17 is the minimum build JDK (AGP 8.13); JDK 21 is recommended.
This SDK uses Kotlin 2.1.20 with AGP 8.13.2 and Gradle 8.14.3. That combination is outside JetBrains' fully tested KGP/AGP/Gradle matrix.
KSP applies when your app uses Kotlin symbol processors (e.g. Hilt, Room). Match the Kotlin Gradle plugin and KSP versions to avoid “KSP too old for Kotlin” errors.
Optional checkout-clicktopay requires Android System WebView / Chrome with WEB_MESSAGE_LISTENER (82+). See Click to Pay — Prerequisites.
The demo app targets SDK 36 and its Robolectric tests pin sdk=34 (app/src/test/resources/robolectric.properties), because Robolectric doesn't run at SDK 36. SDK libraries still target 35.
The SDK is fully compatible with code obfuscation. If you encounter issues:
# Spreedly SDK
-keep class com.spreedly.** { *; }
-keepclassmembers class com.spreedly.** { *; }
# Ktor (if using custom ProGuard rules)
-keep class io.ktor.** { *; }
For questions or issues, please contact Spreedly Support.