Client CraftClient Craft HubStart free

Show Client Craft plans and prices with the purchase-offers source

On this page
Updated 24 Nov 20262 min read

Enable the clientcraft-purchase-offers data source for a site and editors can build a pricing table from your published Client Craft plans and prices.

Plan: All plans (needs the full Client Craft package)

With the full ClientCraft package installed (dotnet add package ClientCraft), the Visual Builder gets a data source named Client Craft public purchase offers (key clientcraft-purchase-offers). It lists the public offers of your seller account: plan name, plan code, currency, billing cadence and price. Editors bind a Collection to it, so the website always shows the prices you actually sell. It shows prices only: it never starts a checkout, activates a plan or exposes customer data.

This source is available with Client Craft (full package). In the free Visual Builder it doesn't appear in the source list. Learn more

Before you start #

  • The site has the ClientCraft package installed and is connected to your Client Craft workspace.
  • You know the key of the site's root node (in Content, open the root and look at Info).

Step by step #

  1. 1
    Allow the siteThe source only answers for site roots you list. Add the root node key to configuration:
    json
    1{
    2 "ClientCraftVisualData": {
    3 "AllowedSites": [ "a1b2c3d4-0000-4000-8000-000000000001" ]
    4 }
    5}

    The key must be a top-level root (level 1), and the page must be inside it.

  2. 2
    Limit the plans (optional)To show only some plans, list their plan codes (up to 32, each up to 120 characters):
    json
    1{
    2 "ClientCraftVisualData": {
    3 "AllowedSites": [ "a1b2c3d4-0000-4000-8000-000000000001" ],
    4 "OfferPlanCodes": [ "starter", "growth" ]
    5 }
    6}

    Without OfferPlanCodes, all public offers are returned.

  3. 3
    Bind a CollectionSave the settings. If the site does not pick them up, restart it. In the builder, insert a Collection, choose Client Craft public purchase offers as its Collection source and connect the texts in its Item template to the fields.
  4. 4
    Check the live pagePublish and open the public page. Each offer becomes one card.

Fields #

Field keyLabelKind
plan-codePlan codeText
nameNameText
currencyCurrencyText
cadenceBilling cadenceText (monthly or annual; "por mês" / "por ano" on Portuguese pages)
pricePriceMoney

Why it says Unavailable #

The source returns Unavailable, and never calls the API, when:

  • the page is shown in preview or in the builder's canvas;
  • the site root isn't in AllowedSites, or the page isn't under it;
  • the API can't be reached.

Design the Collection's When the source is unavailable area for that case, and check the cards on the published page. An invalid OfferPlanCodes list, or more than 100 offers, returns InvalidConfiguration.

What happens next #

Full recipe with layout and states: Add a pricing table backed by a data source.

Was this article helpful?