Skip to content

TokenResponse

The object passed to paymentAction(_:didSucceedWith:) after the buyer successfully submits the payment sheet. Use response.id to create a Payment Instrument via the Finix API.

Token Expiration

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

TokenResponse shape

TokenResponse {
    id: String           // e.g. "TKeD6uad8xZc52Rqg1VhvSBw"
    fingerprint: String  // e.g. "FPRrcobjtdU98gr4sjiqYR1Qg"
    instrument: Int      // instrument type enum
    created: String      // e.g. "2025-06-10T00:31:53.54Z"
    expires: String      // 30 minutes after creation
    isoCurrency: Int     // currency enum
}
FieldDescription
idToken ID — pass this to the Finix API to create a Payment Instrument.
fingerprintUnique fingerprint for the underlying payment instrument.
instrumentInstrument type: payment card or bank account.
expiresTimestamp when the token expires (30 minutes after creation).
isoCurrencyCurrency of the token.
createdTimestamp when the token was created.

Using the token

Pass response.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.

// TokenResponse returned via paymentAction(_:didSucceedWith:):
// response.id          — e.g. "TKeD6uad8xZc52Rqg1VhvSBw"
// response.fingerprint — e.g. "FPRrcobjtdU98gr4sjiqYR1Qg"
// response.instrument  — instrument type (payment card or bank account)
// response.created     — e.g. "2025-06-10T00:31:53.54Z"
// response.expires     — 30 minutes after creation
// response.isoCurrency — currency of the token

extension CheckoutViewController: PaymentActionDelegate {
    func paymentAction(_ action: PaymentAction, didSucceedWith response: TokenResponse) {
        // response.id is the value you pass to the Finix API
        sendTokenToBackend(response.id)
        dismiss(animated: true)
    }

    func paymentAction(_ action: PaymentAction, didFailWith error: Error) {
        print("Error: \(error.localizedDescription)")
        dismiss(animated: true)
    }
}