For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
RegisterLoginSandbox Login
GuidesRecipesAPI Reference
GuidesRecipesAPI Reference
  • Getting Started
    • Getting Started with Checkout
    • Account Setup
    • Card Checkout with Credits
    • Card Checkout
    • Direct USDC Settlement
    • Fiat/Crypto Pay-ins
    • Secure Marketplace Checkout
    • EVM Checkout
    • How to Enable Checkout with Credit Cards
    • Quick Start Marketplace Implementation
    • Payouts
    • Common FAQs
  • Checkout
      • Getting Started with Implmentation
      • Mobile App Payments
        • Swift SDK
        • Android SDK
        • Flutter SDK
        • React Native SDK
        • Browser Redirect Checkout
    • Settlement Locations
  • Payouts
    • Payout Overview
    • What is a Payout
  • Subscriptions
    • Subscriptions Overview
  • Marketplaces
    • Marketplace Overview
    • How Marketplaces Work
    • How to Withdraw USDC
    • Countries Eligible for USDC Withdraw
    • Marketplaces Webhooks
    • Marketplaces Implementation
  • Developer Resources
    • Custom Branding
    • Checkout Implementation
    • Webhooks
  • Merchant Dashboard
    • Login & Account Access
    • Users and Roles
    • Rate Limits
    • Developer Contact
LogoLogo
RegisterLoginSandbox Login
On this page
  • Overview
  • Requirements
  • Installation
  • Integration
  • Variants
  • Theming
  • Dynamic height
  • Resources
CheckoutImplementation OverviewMobile App Payments

Android SDK

Embed the Coinflow card tokenization form natively in a Jetpack Compose app.
Was this page helpful?
Previous

Flutter SDK

Embed the Coinflow card tokenization form natively in a Flutter app.
Next
Built with

Overview

coinflow-card-form is a Jetpack Compose SDK that embeds Coinflow’s card tokenization form directly into Android apps. The user enters their card inside your app, the SDK returns a payment token, and your backend charges the card via the standard Coinflow checkout API.

  • Package: cash.coinflow:coinflow-card-form
  • Distribution: Maven Central
  • Current version: 0.2.0

Requirements

  • Android minSdk 24+
  • Kotlin 1.9+
  • Jetpack Compose

Installation

1// settings.gradle.kts
2dependencyResolutionManagement {
3 repositories {
4 google()
5 mavenCentral()
6 }
7}
8
9// app/build.gradle.kts
10dependencies {
11 implementation("cash.coinflow:coinflow-card-form:0.2.0")
12}

Integration

1

Add the card form composable

Drop CoinflowCardFormView into your Compose layout and pass a CoinflowCardFormController you’ll use to trigger tokenization.

1import androidx.compose.foundation.layout.*
2import androidx.compose.material3.*
3import androidx.compose.runtime.*
4import androidx.compose.ui.Modifier
5import androidx.compose.ui.unit.dp
6import cash.coinflow.cardform.*
7import kotlinx.coroutines.launch
8
9@Composable
10fun PaymentScreen() {
11 val controller = remember { CoinflowCardFormController() }
12 val scope = rememberCoroutineScope()
13
14 Column {
15 CoinflowCardFormView(
16 variant = CardFormVariant.CARD_FORM,
17 merchantId = "your-merchant-id",
18 env = CoinflowEnv.SANDBOX,
19 controller = controller,
20 modifier = Modifier.fillMaxWidth().height(52.dp)
21 )
22
23 Button(onClick = {
24 scope.launch {
25 try {
26 val response = controller.tokenize()
27 println("Token: ${response.token}")
28 } catch (e: Exception) {
29 // surface error to user
30 }
31 }
32 }) {
33 Text("Pay")
34 }
35 }
36}

your-merchant-id is an example placeholder. Use your actual merchant ID from the merchant dashboard, or contact the Coinflow integrations team. Typically read from a BuildConfig field, not hard-coded.

2

Configure the environment

1val env = if (BuildConfig.DEBUG) CoinflowEnv.SANDBOX else CoinflowEnv.PROD
  • CoinflowEnv.SANDBOX — test cards, no real money
  • CoinflowEnv.PROD — live cards, real money
3

Charge the token server-side

controller.tokenize() is a suspend function. It returns a TokenizeResponse:

  • token: String — payment token to send to your backend
  • expMonth: String?, expYear: String? — populated only for variants that collect expiry

Send the token to your server and call Coinflow’s checkout API to charge it. See the Checkout API reference for the full request shape.

Variants

VariantCapturesUse case
CardFormVariant.CARD_FORMNumber, expiry, CVVStandard one-shot capture
CardFormVariant.CARD_NUMBER_FORMNumber + expiryFirst step of a two-step flow
CardFormVariant.CVV_FORMCVV onlyRe-collecting CVV for a card-on-file token

Theming

MerchantTheme styles the rendered form. All fields optional.

1val theme = MerchantTheme(
2 primary = "#165DFB",
3 background = "#ffffff",
4 textColor = "#05092E",
5 ctaColor = "#165DFB",
6 font = "Red Hat Display",
7 style = MerchantStyle.ROUNDED
8)
9
10CoinflowCardFormView(theme = theme, /* ... */)
All theme fields
FieldPurpose
primary, ctaColorAccent / action colors (hex strings)
background, backgroundAccent, backgroundAccent2Form background tones
textColor, textColorAccent, textColorActionInput and label text colors
font, fontSize, fontWeightTypography. font must be available on the device.
styleInput shape: ROUNDED, SHARP, PILL
cardNumberPlaceholder, cvvPlaceholder, expirationPlaceholderOverride input placeholder text
showCardIconToggle the card brand icon (Visa/Mastercard/Amex)

Dynamic height

The hosted form reflows responsively — at narrow widths the inputs wrap to multiple rows. To keep your Compose container fitted, listen for height changes via the onHeightChange callback:

1var formHeight by remember { mutableStateOf(52.dp) }
2
3CoinflowCardFormView(
4 merchantId = "your-merchant-id",
5 controller = controller,
6 modifier = Modifier
7 .fillMaxWidth()
8 .height(formHeight),
9 onHeightChange = { formHeight = it.dp }
10)

The callback receives the rendered content height in CSS pixels (1:1 with dp at default WebView density). Without this wiring the form may be clipped if it wraps.

Resources

  • Source: github.com/coinflow-labs-us/coinflow-android
  • Maven Central: cash.coinflow:coinflow-card-form
  • License: Apache 2.0
  • Checkout API: Card Checkout endpoint