Using the Embeddables CMS to define multiple Stripe prices, and pull them into your Embeddable
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
stripe_prices
in the User Data (it will be stored as an array of objects, where each object represents a row from the table).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).Finally, update the Stripe Checkout to use the output of the Computed Field
{{stripe_line_items}}
.line_items
, which gets sent to Stripe.