In the quickstart app, the Tracking Usage page shows 2 buttons, one of which is disabled. Let’s create an event-based feature in Schematic and entitle it to our plan so that this button will become clickable and track usage.
First, we’ll need to create an event-based feature in Schematic.
new-event-feature-clicked
— this is the value the quickstart app is using.Now that we have a feature, we need to “entitle” it to the plan — this is how we determine how much usage each plan provides and/or how much we’ll charge for each use of this feature.
When you saved the feature, you should have dropped onto that feature’s page. If not, then select “Features” from the top navigation and click on the feature you just created (New Event Feature).
Below is the code that controls the button we just enabled. Tracking users and plans and then determining what a user is entitled to happens within Schematic. Our APIs and SDKs expose an interface similar to a feature flag — you just need to check if the user has access and respond accordingly.
You just created a usage-based feature in Schematic and entitled it to a plan. Usage based features are a cornerstone of most modern billing plans. In this demo, we created a simple entitlement that allows user’s on this plan to consume 25 events/month. There are many more usage based billing setups that Schematic supports.
We recommend you checkout the Components page in the quickstart app to see how to create a fully featured Billing Portal.