The payment form that our Stripe extension generates and places on the checkout page is actually hosted on a separate PCI-compliant server. As such, applying styles to the payment form using custom CSS will not work as expected.
To modify the styling of the payment fields, you will need to insert some custom PHP code using your theme’s functions.php file or a plugin like Code Snippets.
NOTE: We are unable to provide support for customizations under ourΒ Support Policy. If you need to customize a snippet beyond what is shown on this page, we suggestΒ Codeable or aΒ Certified WooExpert.
Clearing transients
β Back to topOur Stripe extension uses transients to cache the payment form styles. For that reason, if you make adjustments to the styling, you will need to clear those transients afterward in order to actually see your changes on the frontend.
You can force the transients to clear by executing the following PHP:
// Shortcode checkout
delete_transient( 'wc_stripe_appearance' );
// Block checkout
delete_transient( 'wc_stripe_blocks_appearance' );
You can do this using the Code Snippets plugin like so:

The Elements Appearance API
β Back to topAs noted above, the form fields shown by our Stripe extension are actually embedded from Stripeβs servers. Youβll need to use theirΒ Elements Appearance APIΒ to alter the styling of the fields. This API is implemented via theΒ wc_stripe_upe_paramsΒ filter.
There are three levels of customization available:
- Themes: Three basic, pre-built styles that may suit your website immediately.
- Variables:Β Allows you to control the appearance of many components at once.
- Rules:Β These provide complete control over every individual component.
Themes are the easiest to implement in a brief snippet, but they may not match the exact look and feel of your site. To do that, you will likely need to use rules, although doing so involves a higher degree of complexity.
Themes
β Back to topStripeβsΒ Elements Appearance APIΒ provides three pre-built themes as shown near the top of that page:Β stripe,Β night, andΒ flat. These are good for quickly altering the appearance of the entire form.
For example, if your site has a darker background color, theΒ nightΒ theme might work pretty well without further customization needed.
add_filter( 'wc_stripe_upe_params', function ( $stripe_params ) {
// Affects block checkout
$stripe_params['blocksAppearance'] = (object) [ 'theme' => 'night' ];
// Affects shortcode checkout
$stripe_params['appearance'] = (object) [ 'theme' => 'night' ];
return $stripe_params;
} );
Hereβs what that would look like:

Variables
β Back to topVariables affect the appearance of many components at once.
As an example, consider the following snippet, which changes all fonts to monospace.
add_filter( 'wc_stripe_upe_params', function ( $stripe_params ) {
// Block checkout
$stripe_params['blocksAppearance'] = (object) [
'variables' => (object) [
'fontFamily' => 'monospace',
],
];
// Shortcode checkout
$stripe_params['appearance'] = (object) [
'variables' => (object) [
'fontFamily' => 'monospace',
],
];
return $stripe_params;
} );
The result is as you’d expect:

Rules
β Back to topThe rules method is very similar to CSS, in that you need to assignΒ propertiesΒ to certain selectors (form components, in this case) to achieve the desired outcome. This allows for very granular customization.
Once you have determined which component you want to modify, you can use the following snippet as a template for your own code. Simply replaceΒ COMPONENT,Β PROPERTY, andΒ VALUEΒ with your desired modifications.
add_filter( 'wc_stripe_upe_params', function ( $stripe_params ) {
$stripe_params['blocksAppearance'] = (object) [
'rules' => (object) [
'.COMPONENT' => (object) [
'PROPERTY' => 'VALUE',
]
],
];
return $stripe_params;
} );
For example, this snippet changes the color and weight of the label fonts:
add_filter( 'wc_stripe_upe_params', function ( $stripe_params ) {
// Block checkout only
$stripe_params['blocksAppearance'] = (object) [
'rules' => (object) [
'.Label' => (object) [
'fontWeight' => 'bold',
'color' => 'blue'
]
],
];
return $stripe_params;
} );
The result is like so:

You can expand on that by using the states, pseudo-classes, and pseudo-elements shownΒ in Stripeβs documentation. They also have a list ofΒ available properties.
For example, to change the border of an invalid input, you could use this:
add_filter( 'wc_stripe_upe_params', function ( $stripe_params ) {
$stripe_params['blocksAppearance'] = (object) [
'rules' => (object) [
'.Input--invalid' => (object) [
'border' => 'thick double', ]
],
];
return $stripe_params;
} );
The result being:

Other options
β Back to topThere are two additional options you can set that affect the behavior of the form fields:Β labelsΒ andΒ disableAnimations.
labels: eitherΒaboveΒ orΒfloatingaboveshows the field labels (e.g. “Card number”) above the fieldfloatingshows the field labels inside the field itself
disableAnimations: eitherΒtrueΒ orΒfalsefalsedoes exactly what it sounds like: turns off instances of animated movement in the payment form.