View as Markdown

Pricing table

Show your plans on your own site with one script tag. Prices stay in step with your catalogue.

Create a table

A pricing table is an ordered list of entries. Each entry pairs a monthly plan with an annual plan, or names just one of them. Creating one needs a secret key with the catalog:write scope.

terminal
curl -X POST https://globalymint.com/api/v1/pricing-tables \
  -H "Authorization: Bearer $MINT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Public pricing",
    "default_interval": "annual",
    "checkout_url": "https://app.example.com/upgrade?plan={plan_id}&interval={interval}",
    "entries": [
      {
        "monthly_plan_id": "7a2d9c4e-1f3b-4e5a-9b6c-0d1e2f3a4b5c",
        "annual_plan_id": "8b3e0d5f-2a4c-4f6b-8c7d-1e2f3a4b5c6d",
        "highlight": true,
        "features": ["Unlimited envelopes"]
      }
    ]
  }'
FieldNotes
entries1 to 8. Each has monthly_plan_id, annual_plan_id or both, plus optional highlight, features (up to 20 lines) and cta_label.
default_intervalmonthly (the default) or annual: which side of the toggle shows first.
checkout_urlWhere each plan's button links. {plan_id}, {plan_code} and {interval} are filled in.
activeDefault true. An inactive table is not shown to visitors.

Embed it

Create a publishable key (pk_test_… or pk_live_…) and add two tags to your page:

pricing.html
<div data-mint-pricing-table="TABLE_ID" data-publishable-key="pk_live_…"></div>
<script src="https://pay.globalymint.com/embed/pricing-table.js" async></script>

Optional attributes on the div:

AttributeEffect
data-intervalmonthly or annual: the side of the toggle shown first, instead of the table's default.
data-checkout-urlOverrides the table's checkout_url on this page.

The script has no dependencies and renders inside a Shadow DOM, so your CSS cannot break it and its CSS cannot leak into your page.

From a click to a checkout

A plan's button is a plain link to your checkout_url. Your server knows who is signed in, so it does the rest:

  1. Read plan and interval from the query string.
  2. Make sure the visitor is signed in, and that they exist as a customer.
  3. Open a checkout session with your secret key.
  4. Redirect to the session URL.

Anonymous visitors never create sessions, and a secret key never reaches the browser.

What a publishable key can read

One endpoint: GET /api/v1/pricing-tables/{id}. It returns the table's plans and your branding, and never customer data. An inactive table answers 404 to a publishable key. On every other endpoint a publishable key answers 403.

On this page