Show Client Craft plans and prices with the purchase-offers source
On this page
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.
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.
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 #
- 1Allow the siteThe source only answers for site roots you list. Add the root node key to configuration: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.
- 2Limit the plans (optional)To show only some plans, list their plan codes (up to 32, each up to 120 characters):1{2 "ClientCraftVisualData": {3 "AllowedSites": [ "a1b2c3d4-0000-4000-8000-000000000001" ],4 "OfferPlanCodes": [ "starter", "growth" ]5 }6}
Without
OfferPlanCodes, all public offers are returned. - 3Bind 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.
- 4Check the live pagePublish and open the public page. Each offer becomes one card.
Fields #
| Field key | Label | Kind |
|---|---|---|
plan-code | Plan code | Text |
name | Name | Text |
currency | Currency | Text |
cadence | Billing cadence | Text (monthly or annual; "por mês" / "por ano" on Portuguese pages) |
price | Price | Money |
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.