Controls the images and text displayed in the PaymentSheet. Pass an instance to the paymentSheetResources parameter of any PaymentSheet composable.
All properties are optional. Omit any you don't need and the default value will be used.
PaymentSheetResources shape
data class PaymentSheetResources(
@DrawableRes val logoDrawable: Int = R.drawable.ic_default_logo,
@StringRes val logoText: Int = R.string.default_logo_text,
@StringRes val tokenizeButtonText: Int = R.string.btn_tokenize,
@StringRes val cancelButtonText: Int = R.string.btn_cancel,
val cancelButtonWeight: Float = 0.6f,
val tokenizeButtonWeight: Float = 0.8f,
)| Property | Type | Default | Description |
|---|---|---|---|
logoDrawable | @DrawableRes Int | Finix default logo | Drawable resource displayed in the top-left of the form. |
logoText | @StringRes Int | "Daphne's Corner" | String resource displayed next to the logo. |
tokenizeButtonText | @StringRes Int | "Tokenize" | Label for the submit button. |
cancelButtonText | @StringRes Int | "Cancel" | Label for the cancel button. |
tokenizeButtonWeight | Float | 0.8 | Horizontal weight of the submit button relative to the cancel button. |
cancelButtonWeight | Float | 0.6 | Horizontal weight of the cancel button relative to the submit button. |
logoDrawable / logoText
logoDrawable sets the image displayed at the top of the form. logoText sets the label displayed to the right of the image.
Both accept Android resource references defined in your res/ directory.
tokenizeButtonText / cancelButtonText
Override the default button labels with your own string resources. Common overrides: "Pay Now", "Confirm", "Back".
tokenizeButtonWeight / cancelButtonWeight
Controls the relative horizontal size of each button. A higher weight results in a wider button. Both default to less than 1.0 to leave padding around the buttons.
Full example
Pass PaymentSheetResources to any PaymentSheet composable via the paymentSheetResources parameter.
data class PaymentSheetResources(
@DrawableRes val logoDrawable: Int = R.drawable.ic_default_logo,
@StringRes val logoText: Int = R.string.default_logo_text,
@StringRes val tokenizeButtonText: Int = R.string.btn_tokenize,
@StringRes val cancelButtonText: Int = R.string.btn_cancel,
val cancelButtonWeight: Float = 0.6f,
val tokenizeButtonWeight: Float = 0.8f,
)
PaymentSheetResources(
logoDrawable = R.drawable.my_logo,
logoText = R.string.my_brand_name
)
PaymentSheetResources(
tokenizeButtonText = R.string.pay_now,
cancelButtonText = R.string.go_back
)
// Wider tokenize button, narrower cancel button
PaymentSheetResources(
tokenizeButtonWeight = 1.0f,
cancelButtonWeight = 0.5f
)
CompletePaymentSheetOutlined(
applicationId = "APgPDQrLD52TYvqazjHJJchM",
isSandbox = false,
paymentSheetResources = PaymentSheetResources(
logoDrawable = R.drawable.my_logo,
logoText = R.string.my_brand_name,
tokenizeButtonText = R.string.pay_now,
cancelButtonText = R.string.go_back,
tokenizeButtonWeight = 1.0f,
cancelButtonWeight = 0.5f
),
onDismiss = { viewModel.setShowPaymentSheet(false) },
onNegativeClick = { viewModel.setShowPaymentSheet(false) },
onPositiveClick = { token ->
viewModel.saveTokenResponse(token)
viewModel.setShowPaymentSheet(false)
}
)