Theme Configuration
Provide the
theme property on the object you pass into checkout.mount('element-id', { ...config }) after creating the instance with new PayNextCheckout(), as shown in Mount the Checkout.'light' | 'dark' | 'system'
Theme mode for the checkout UI.
'light': Fixed light theme'dark': Fixed dark theme'system': Resolves to browser’sprefers-color-schemeat mount time, then fixedundefined: Defaults to'light'and listens for system theme changes
When
theme is undefined, the SDK automatically updates when the user changes their system theme preference. When explicitly set (including 'system'), the theme is fixed and does not listen to system changes.Payment Button Styling
Payment buttons automatically adapt to the theme:- Apple Pay:
style: 'black'(light) /'white'(dark) - Google Pay:
color: 'black'(light) /'white'(dark) - PayPal:
color: 'gold'(light) /'white'(dark) - Pix: white background with an
#e0e0e0border (light) /#1a1a1abackground with a#333border (dark)
styles.ApplePayButton, styles.GooglePayButton, styles.PayPalButton, or styles.PixButton override theme defaults.
Pix Form Theming
Available from SDK version 1.1.0.
- Light theme: white field background, dark text
- Dark theme: dark field background, light text
Custom Pix Form Colors
Override individual colors and the border radius withstyles.PixForm (type PixFormStyles). These map to Stripe’s Appearance API variables, not the --paynext-sdk-* tokens below, since the Pix form renders inside a Stripe-hosted iframe.
pix-form-theme.ts
CSS Variables
Override theme tokens by passingstyles.cssVariables (type CSSVariablesConfig) when you mount the SDK, or target .checkout / .checkout.dark classes from your stylesheet. Unset values fall back to the active theme defaults.
Variables marked “inherits” are not redefined in dark mode and use the light theme value. Variables marked “same” are explicitly set to the same value in both themes.
Complete Token Reference
Override from Config
PasscssVariables through the styles option when mounting:
config-override.ts
Override from External CSS
Target the.checkout class from your stylesheet:
styles.css
Style Presets
Create reusable style presets for different design systems:- Minimal
- Colorful
- Brand Colors
minimal-preset.ts
TypeScript Reference
The SDK exports full type definitions for theme configuration:types.ts
All
CSSVariablesConfig properties are optional. Only override the tokens you need to change.