B
B
Billflow
Search…
Customize Elements
Billflow Configuration API for customizing Billflow UI elements
Custom elements are possible starting in Billflow v4 beta. This page describes what is available for customization and how it works with examples.

Customizable UI elements

If the out of the box UI elements or text does not fully fit what you need, we've got you covered. This is the list of customizable UIs within the Billflow embeds.

Embed Elements

Pricing Table

This customization will apply to the pricing page, plan picker and portal embed's change plan view.

Checkout

This customization will apply to the pricing page's checkout modal and the checkout page embed.

The API

Configuration Structure

This is how you would create the structure and pass it into the Billflow configuration in the embed code. For each customElement mentioned, refer to the Custom element API section.
1
/**
2
* You would pass this custom elements object into billflowSettings
3
* with your embed code like the code fragment below.
4
*
5
* windows.billflowSettings = {
6
* billing_page_id: 'xxxxxxxxxxxxxx',
7
* options: {
8
* customElements,
9
* }
10
*/
11
12
const customElements = {
13
elements: {
14
pricing: { // define all customizable elements within the pricing table view here
15
tiers: [
16
{
17
name: "Basic", // your tier name to be customized
18
highlighted: {
19
element: customHighlightedBasic // your custom element for this tier's highlight
20
},
21
select: {
22
element: customSelectBasic // your custom element for select button for this tier.
23
},
24
prices: [
25
{
26
id: "price_1jw91203djejd23", // your Stripe price id displayed in this tier.
27
element: customPrice // your custom element for price item in the table.
28
}
29
]
30
}
31
]
32
},
33
checkout: { // define all customizable elements within the checkout view here
34
prices: [
35
{
36
id: "price_1jw91203djejd23", // your Stripe price id displayed in this checkout form.
37
description: {
38
element: customDescription, // your custom element for this price description
39
},
40
price: {
41
element: customPriceDisplay, // your custom element for this price display
42
}
43
}
44
]
45
}
46
}
47
}
Copied!

Custom element API

The interface to this custom element api is the same for each element level as follows:
1
{
2
type: "div", // Required, the element wrapping element type.
3
props: {}, // Optional, the props you'd like to pass to the wrapping element, such as className.
4
render: (props) => { // Optional instead of children, allows you to return HTML with dynamic values.
5
// prop are based on the current element being customized,
6
// data properties would be for example, the Stripe price
7
// object if customzing a price item.
8
console.log("Log the props to see what's available to you", props)
9
const { unit_amount } = props
10
return `<div>${unit_amount} per month</div>`
11
},
12
children: "Static Text" // Optional instead of render, if you simply want to customize it with static text.
13
}
Copied!

Examples

There are times when you want to customize the pricing information in the pricing table or even add extra elements to it. We will show you how to do it with the following examples.

Embed: Loader

Displaying the custom loader instead of our standard spinning circle

Pricing: Pricing Items

This section describes how you can customize the Pricing Items like the following example.
Customized Basic Tier (Left) Price Item Example
To customize a pricing item, you will first create a custom pricing item element like this.
1
/** Create the custom pricing item */
2
const CustomBasicPrice = {
3
id: "price_HDa0zWHKXsY2sb", // replace with your own Stripe price id
4
element: {
5
type: "div",
6
render: (props) => {
7
// props is the price object in this case
8
const { currency, unit_amount, priceRenderer } = props;
9
const price = priceRenderer({amount: unit_amount ,currency})
10
return `<div>
11
${price} <span>/ mo.</span>
12
<i>Send up to 100,000 emails/mo before overages apply.</i>
13
</div>`;
14
}
15
}
16
}
Copied!
The id specifies the Stripe price item to customize within the tier.
The element is the custom element you will create.
Element properties
type
Required
string
a valid html type
props
Optional
object
any valid props for the html element, such as class, id, etc.
render
Required
function
a render function that will return the custom content as a string, basic html tags are will work.
Stripe price object is passed to this function from Billflow, you can use the values to create the custom element.
Then you can pass the CustomBasicPrice to the config options.
1
/** Add the custom pricing item element
2
to Billflow Config options like this. */
3
{
4
billing_page_id: "5GNX3vmderQxoquHKUPe",
5
options: {
6
elements: {
7
pricing: {
8
tiers: [
9
{
10
name: "Basic",
11
prices: [ CustomBasicPrice ]
12
}
13
]
14
}
15
}
16
}
17
}
Copied!

Pricing: Select Plan Button

This section describes how you can customize the Select Plan Button like the following example.
Customize the custom tier's Select Plan Button to open your Intercom chat
To customize a Select Plan Button, you will first create a custom element like this.
1
/** Create the custom Enterprise tier button */
2
const CustomEnterpriseButton = {
3
element: {
4
type: "button", // element type
5
props: { // any valid props that Reactjs accepts
6
onClick: (e) => {
7
e.preventDefault();
8
alert("Trigger a custom action, such as open intercom.")
9
},
10
id: "custom-button",
11
className:
12
"custom-button sc-csTbgd kglWtV bf-button __full _3NM6Cu2g7QjO6j4WSEYBGp _1RTkeWIbayZ7rSk_0XZ-hN",
13
href: "#"
14
},
15
children: "Contact Us" // the child element to be rendered in the custom element.
16
}
17
}
18
Copied!
Then you can pass the CustomEnterpriseTier to the config options.
1
/** Add the custom Enterprise tier button element
2
to Billflow Config options like this. */
3
{
4
billing_page_id: "5GNX3vmderQxoquHKUPe",
5
options: {
6
elements: {
7
pricing: {
8
tiers: [
9
{
10
name: "Enterprise", // the sb_tier name you want to customize
11
select: CustomEnterpriseButton // customizing the select button for the Custom tier
12
}
13
]
14
}
15
}
16
}
17
}
Copied!

Checkout: Price Item description

This section describes how you can customize the Price Description within the checkout view like the following example.
Customized checkout price description highlighted in red
To customize a price description, you will first create a custom element like this.
1
const CustomPriceDescription = {
2
"id": "price_HDa0zWHKXsY2sb",
3
"description": {
4
"element": {
5
"type": "div",
6
"props": {
7
"className": "__custom-description"
8
},
9
"render": (props) => {
10
return `<div>
11
<div>Workflow: First 5 images</div>
12
<div>Explanation of Isolation</div>
13
</div>`
14
}
15
}
16
}
17
}
Copied!
Then you can pass the CustomPriceDescription to the config options.
1
/** Add the CustomPriceDescription element
2
to Billflow Config options like this. */
3
{
4
billing_page_id: "TMXnsJS2S7odVGyIW5Qc",
5
options: {
6
elements: {
7
checkout: {
8
prices: [
9
CustomPriceDescription, // the custom price description element created above
10
]
11
}
12
}
13
}
14
}
15
Copied!

Checkout: Price Item Price

This section describes how you can customize the Price within the checkout view like the following example.
Customized checkout price highlighted in red
To customize a checkout price, you will first create a custom element like this.
1
const CustomCheckoutPrice = {
2
id: "price_HDa0zWHKXsY2sb", // replace with your own Stripe price id
3
price: {
4
element: {
5
type: "div",
6
props: {
7
className: "__custom-amount"
8
},
9
render: (props) => {
10
const { unit_amount, currency, formatters } = props;
11
const amount = formatters.price({
12
amount: unit_amount,
13
currency
14
});
15
return `<div>
16
<div>${amount} / mo.</div>
17
<div>additional images</div>
18
</div>`;
19
}
20
}
21
}
22
};
Copied!
Then you can pass the CustomCheckoutPrice to the config options.
1
/** Add the CustomCheckoutPrice element
2
to Billflow Config options like this. */
3
{
4
billing_page_id: "TMXnsJS2S7odVGyIW5Qc", // replace with your own billing page id
5
options: {
6
elements: {
7
checkout: {
8
prices: [
9
CustomCheckoutPrice, // the custom checout price
10
]
11
}
12
}
13
}
14
}
Copied!
Last modified 3mo ago