Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="pricing-page-container">
  <h1>Choose your plan</h1>
  <div class="pricing-toggle">
    <input type="radio" name="plan" value="month" id="month" onclick="getPrices('month')"><label for="month">Monthly</label>
    <input type="radio" name="plan" value="year" id="year" onclick="getPrices('year')" checked><label for="year">Yearly <sup>save 20%</sup></label>
  <div class="pricing-grid">
    <div class="starter-plan">
      <p id="starter-price">$100.00</p>
      <p><small>per user</small></p>
      <button>Sign up now</button>
    <div class="pro-plan">
      <p id="pro-price">$300.00</p>
      <p><small>per user</small></p>
      <button>Sign up now</button>
    <div class="enterprise-plan">
      <p>Contact us</p>
      <p><small>bespoke pricing</small></p>
      <button>Inquire now</button>
  <div class="country-selector">
    <select name="country" id="country" autocomplete="off">
      <option value="US">🇺🇸 United States</option>
      <option value="GB">🇬🇧 United Kingdom</option>
      <option value="ES">🇪🇸 Spain</option>
      <option value="IN">🇮🇳 India</option>
      <option value="US">🌍 Other</option>
      For the tutorial, check out:
      <a href="">Build a pricing page</a> -
      <a href="">


                .pricing-page-container {
  max-width: 900px;
  margin: auto;
  text-align: center;
  margin-top: 2em;
  padding-left: 1em;
  padding-right: 1em;
.pricing-grid {
  display: block;
  margin-bottom: 1em;
.pricing-grid .starter-plan {
  background-color: AliceBlue;
.pricing-grid .pro-plan {
  background-color: HoneyDew;
.pricing-grid .enterprise-plan {
  background-color: LavenderBlush;
.pricing-grid > * {
  padding: 1rem;
@media (min-width: 768px) {
  .pricing-grid {
    display: grid;
    grid-auto-rows: 1fr;
    grid-template-columns: 1fr 1fr 1fr;



  token: "test_7d279f61a3499fed520f7cd8c08" // replace with a client-side token

// define products and prices
var starterProduct = "pro_01gsz4s0w61y0pp88528f1wvvb";
var proProduct = "pro_01gsz4t5hdjse780zja8vvr7jg";
var monthItems = [
    quantity: 1,
    priceId: "pri_01gsz8ntc6z7npqqp6j4ys0w1w"
    quantity: 1,
    priceId: "pri_01gsz8x8sawmvhz1pv30nge1ke"
var yearItems = [
    quantity: 1,
    priceId: "pri_01gsz8s48pyr4mbhvv2xfggesg"
    quantity: 1,
    priceId: "pri_01gsz8z1q1n00f12qt82y31smh"

// DOM queries
var starterPriceLabel = document.getElementById("starter-price");
var proPriceLabel = document.getElementById("pro-price");

// set initial billing cycle
var billingCycle = "year";

// set initial country
var billingCountry = "US";

// choose country
var dropdown = document.getElementById("country");
dropdown.addEventListener("change", function () {
  billingCountry = dropdown.value;
  console.log("country changed: " + billingCountry);

// get prices
function getPrices(cycle) {
  if (cycle === "month") {
    var billingCycle = cycle;
    var itemsList = monthItems;
  } else if (cycle === "year") {
    var billingCycle = cycle;
    var itemsList = yearItems;

  var request = {
    items: itemsList,
    address: {
      countryCode: billingCountry
    .then((result) => {

      var items =;
      for (item of items) {
        if ( === starterProduct) {
          starterPriceLabel.innerHTML = item.formattedTotals.subtotal;
          console.log("starter " + item.formattedTotals.subtotal);
        } else if ( === proProduct) {
          proPriceLabel.innerHTML = item.formattedTotals.subtotal;
          console.log("pro " + item.formattedTotals.subtotal);
    .catch((error) => {

window.onload = getPrices(billingCycle);