Using the Embeddables CMS to define multiple Stripe prices, and pull them into your Embeddable
If you handle multiple Stripe products or prices in your Embeddable, the Embeddables CMS is a great way to store them and keep them updated.
Using the Embeddables CMS for this has the following benefits:
Add a table called Prices in the Embeddables CMS
Column Name | Column Key | What it’s for |
---|---|---|
Plan Name | plan_name | Helps you identify what the price corresponds to. |
Stripe Price ID | stripe_price_id | Stores the price ID from Stripe. |
Price (optional) | price_amount | Helps you remember what the amount is set to for this price in Stripe. |
One or more price attributes e.g. Price Plan | price_plan | Set one or more of these columns to distinguish your plans, and be used later in the logic of your Embeddable to determine which price to use for a user. |
Add the prices to your new table
Pull the prices into your Embeddable
What this does:
stripe_prices
in the User Data (it will be stored as an array of objects, where each object represents a row from the table).A UI for connecting an Embeddable to a table in the Embeddables CMS, so that you don’t need to modify the JSON, is coming soon!
Set up a Computed Field to choose the correct price
stripe_prices
to the list of Registered Keys in the Embeddable Options, so that you can access it in Computed Fields.stripe_line_items
- this will calculate the exact line items to pass to the Stripe Checkout.stripe_prices
to the inputs of the Computed Field, along with any other User Data keys you’ll need in order to choose the correct price (e.g. a chosen_price_plan
key from an Option Selector).It’s important to use a test price ID when in test mode, because Stripe’s test mode insists on using test price IDs, not live ones.
Finally, update the Stripe Checkout to use the output of the Computed Field
{{stripe_line_items}}
.This tells the Stripe component to use the output of your Computed Field as the value of line_items
, which gets sent to Stripe.
Read more about how payments works in Embeddables, including how to set up a Stripe Checkout and accept payments.
Using the Embeddables CMS to define multiple Stripe prices, and pull them into your Embeddable
If you handle multiple Stripe products or prices in your Embeddable, the Embeddables CMS is a great way to store them and keep them updated.
Using the Embeddables CMS for this has the following benefits:
Add a table called Prices in the Embeddables CMS
Column Name | Column Key | What it’s for |
---|---|---|
Plan Name | plan_name | Helps you identify what the price corresponds to. |
Stripe Price ID | stripe_price_id | Stores the price ID from Stripe. |
Price (optional) | price_amount | Helps you remember what the amount is set to for this price in Stripe. |
One or more price attributes e.g. Price Plan | price_plan | Set one or more of these columns to distinguish your plans, and be used later in the logic of your Embeddable to determine which price to use for a user. |
Add the prices to your new table
Pull the prices into your Embeddable
What this does:
stripe_prices
in the User Data (it will be stored as an array of objects, where each object represents a row from the table).A UI for connecting an Embeddable to a table in the Embeddables CMS, so that you don’t need to modify the JSON, is coming soon!
Set up a Computed Field to choose the correct price
stripe_prices
to the list of Registered Keys in the Embeddable Options, so that you can access it in Computed Fields.stripe_line_items
- this will calculate the exact line items to pass to the Stripe Checkout.stripe_prices
to the inputs of the Computed Field, along with any other User Data keys you’ll need in order to choose the correct price (e.g. a chosen_price_plan
key from an Option Selector).It’s important to use a test price ID when in test mode, because Stripe’s test mode insists on using test price IDs, not live ones.
Finally, update the Stripe Checkout to use the output of the Computed Field
{{stripe_line_items}}
.This tells the Stripe component to use the output of your Computed Field as the value of line_items
, which gets sent to Stripe.
Read more about how payments works in Embeddables, including how to set up a Stripe Checkout and accept payments.