Skip to content

TokenizedResponse

The object passed to the onPositiveClick callback after the buyer successfully submits the PaymentSheet. Use token.id to create a Payment Instrument via the Finix API.

Token Expiration

Tokens expire 30 minutes after creation. Pass token.id to your backend and create a Payment Instrument immediately.

TokenizedResponse shape

data class TokenizedResponse(
    val id: String?,
    val fingerprint: String?,
    val createdAt: String?,
    val updatedAt: String?,
    val type: String?,
    val expiresAt: String?,
    val currency: String?,
)
FieldDescription
idToken ID — pass this to the Finix API to create a Payment Instrument.
fingerprintUnique fingerprint for the underlying payment instrument.
type"PAYMENT_CARD" or "BANK_ACCOUNT".
expiresAtTimestamp when the token expires (30 minutes after creation).
currency"USD" for most tokens.
createdAtTimestamp when the token was created.
updatedAtTimestamp of the last update.

Using the token

Pass token.id to your backend, then call the Finix API to create a Payment Instrument. Once created, use the Payment Instrument ID for all subsequent Finix API calls.

Branching on token type

Use token.type to handle card and bank account tokens differently if your integration accepts both.

// TokenizedResponse returned via onPositiveClick:
data class TokenizedResponse(
    val id: String?,          // e.g. "TKeD6uad8xZc52Rqg1VhvSBw"
    val fingerprint: String?, // e.g. "FPRrcobjtdU98gr4sjiqYR1Qg"
    val createdAt: String?,   // e.g. "2025-06-10T00:31:53.54Z"
    val updatedAt: String?,
    val type: String?,        // "PAYMENT_CARD" or "BANK_ACCOUNT"
    val expiresAt: String?,   // 30 minutes after creation
    val currency: String?,    // "USD"
)

CompletePaymentSheetOutlined(
    applicationId = "APgPDQrLD52TYvqazjHJJchM",
    isSandbox = false,
    onDismiss = { viewModel.setShowPaymentSheet(false) },
    onNegativeClick = { viewModel.setShowPaymentSheet(false) },
    onPositiveClick = { token ->
        // token.id is the value you pass to the Finix API
        viewModel.saveTokenResponse(token)
        viewModel.setShowPaymentSheet(false)
    }
)

onPositiveClick = { token ->
    when (token.type) {
        "PAYMENT_CARD" -> {
            // Handle card token
        }
        "BANK_ACCOUNT" -> {
            // Handle bank account token
        }
    }
}