Defining experience
Gain a better understanding of how to use the experience object to style a Prebuilt Checkout
In options.style
, you can use experience
to assign values to the properties of the CSS selectors that control Prebuilt Checkout's appearance and visual behavior.
When defining a create checkout-session request, you can also assign the experience
object to style
.
On this page, you'll find:
For details on how to perform even more granular styling of the payment collection stage, refer to Define the payment experience on the Configuring Prebuilt Checkout.
Primary parts of experience
experience
At the
experience
level are styles, which control Prebuilt Checkout's general, overall appearance, such as itsbackgroundColor
and fonts, as well as the color and roundness of its border. At this level, you can also define alogo
. At the next level down inexperience
areelements
andsections
.elements
are the various parts of theexperience
, such asprogressBars
,headings
,text
,tables
,separators
,links
,textFields
,checkboxes
,radioButtons
, andbuttons
.sections
are the various stages that users might pass through while checking out, along with theheader
andfooter
they see during each stage. With the exception ofheader
, allsections
haveelements
.The keys in the JSON correspond to a CSS property. The following are some common keys in the
experience
object and the CSS property that their value defines:
JSON key | CSS property |
---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
You can add pseudo-class keywords to change how something is styled based on its state or condition, such as when a user clicks a checkbox, hovers over a button, or selects a payment method or when a value is determined to be invalid. In most cases, you define these keywords in
elements
.
The following table captures examples of various styles you can control:
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
Styling express payment methods
You can use expressCheckout
to style the various payment method buttons which display in that section.
payPal
payPal
Key | Description | Supported values |
---|---|---|
| Customizes the button's label |
|
| Sets the size of the button |
|
| Sets the color of the button |
|
| Determines whether the button is pill or rectangular shaped |
|
googlePay
googlePay
Key | Description | Supported values |
---|---|---|
| Defines the button's label and type |
|
| Defines the button's background color |
|
applePay
applePay
Key | Description | Supported values |
---|---|---|
| Defines the button's label and type |
|
| Defines the button's background color |
|
amazonPay
amazonPay
Key | Description | Supported values |
---|---|---|
| Defines the button's background color |
|
The rules of experience
experience
The structure of experience
determines which styles take precedence in the CSS. Generally, styles at a lower level in the JSON hierarchy take precedence over styles at a higher level:
A style in
elements
overrides that style inexperience
A pseudo-class selector style in
elements
overrides that style in the sameelements
A style in
sections
overrides that style inexperience
A style in an
elements
ofsections
overrides that style in the correspondingelements
A pseudo-class selector style in an
elements
ofsections
overrides that pseudo-class selector style in the correspondingelements
The complete experience
experience
The following is an example of the full experience
object.
Deprecated style objects
The experience
object is our recommended styling solution. However, in options.style
, you can alternatively define modal
and textField
.
Last updated