Payment visual customizations
Configure the appearance of Payment’s selector and screens through MPCheckoutAppearance before building checkout. sellerInfo provides the store name and logo; it does not replace theme tokens.
The checkoutAppearance argument is optional on Android. Use System, Light or Dark from MercadoPagoUserInterfaceStyle to select the device mode, light slot or dark slot.
import com.mercadopago.sdk.android.checkout.core.MercadoPagoCheckout
import com.mercadopago.sdk.android.checkout.core.model.*
import com.mercadopago.sdk.android.foundation.theme.MercadoPagoUserInterfaceStyle
val appearance = MPCheckoutAppearance(
style = MercadoPagoUserInterfaceStyle.System,
)
val checkout = MercadoPagoCheckout.Builder(
context = activity,
checkoutType = MPCheckoutType.Payment(order = order),
checkoutAppearance = appearance,
).build()
MercadoPagoThemeConfiguration receives lightTheme and darkTheme. Each public MercadoPagoThemeProvider.Default provider groups color, spacing, radius, borderWidth, shape and typography. This example changes only the text accent color.
import androidx.compose.ui.graphics.Color
import com.mercadopago.sdk.android.checkout.core.model.MPCheckoutAppearance
import com.mercadopago.sdk.android.foundation.theme.*
val base = MercadoPagoThemes.Default.lightTheme as MercadoPagoThemeProvider.Default
val customTheme = base.copy(
color = base.color.copy(
text = base.color.text.copy(accent = Color(0xFF0066CC)),
),
)
val appearance = MPCheckoutAppearance(
theme = MercadoPagoThemeConfiguration(
lightTheme = customTheme,
darkTheme = customTheme,
),
)
The cast uses the default theme provider. Use public APIs rather than internal implementation symbols.
Provide light and dark themes
These examples use the same palette in both slots and do not implement a complete dark theme. The default configuration also uses the light palette in both slots; selecting dark mode does not create a new palette.
- Android: supply complete
MercadoPagoThemeProvider.Defaultproviders with all six categories inlightThemeanddarkTheme. - iOS: supply complete
MPThemeimplementations intheme: .init(light: lightTheme, dark: darkTheme), includingbuttonsandtextFields.
Validate appearance
Check applicable selector, new card, CVV, installment, review, result and fallback screens. Test contrast, long text, system font sizes, disabled states, and light and dark modes. Configure tokens before building checkout. These tokens do not configure business data or text returned by the backend.
Return to Payment integration to build and present checkout.