This post introduces how to manage SaaS feature entitlements efficiently using the Stripe API. It explains why it's important to provide multiple plans to your customers and how to differentiate each plan through entitlement management. With the Stripe API, managing entitlements can become more straightforward, allowing you to focus on building and improving your core services.
Implement entitlements management linked to plans
One of the key challenges when offering multiple pricing plans for SaaS products is managing access rights for each plan. This involves generating a list of features and relationships for each plan, referencing subscription, pricing, and access information, and manipulating related databases and resources when new features are released or when customers change their plans. This section provides insights into these issues and offers solutions to manage them effectively.
SaaS products offer multiple pricing plans to customers, which typically include:
- A free or low-cost plan that allows customers to evaluate the service and consider it for future large-scale projects.
- A top-tier plan that provides essential features and support for major customers.
- A mid-range plan that balances price and features. For many SaaS companies, a significant portion of their revenue comes from these high-end plans.
Profitability data shows that high-end plans contribute significantly to revenue. For instance, in many SaaS businesses, 70% of revenue often comes from top-tier plans. This emphasizes the need to strategically design and price higher-level plans to maximize profitability. For more information on SaaS pricing, refer to the guide published by Stripe, which provides case studies and insights on pricing strategies.
To address the challenge of managing access rights efficiently, companies can use databases or APIs to manage permissions. However, for startups or project teams launching new businesses, this approach may not be ideal due to getting the development resources required. When developing a new web service from scratch, it is essential to focus on creating a product that is as attractive and valuable to customers as possible. By using Stripe, you can manage the flow and billing of your application while handling access permissions for each plan via API calls.
Centralized plan and permission management with Stripe entitlements API
Stripe provides an Entitlement management API. You can use this API to register features to be offered to customers and associate them with products. To experience the configuration flow and operation, first create a pricing plan and an entitlement management system. In the following example, a media site offers three types of content distribution:
Product Name | Price | Permissions |
---|---|---|
Free | $0 | View free articles |
Personal | $98/month | View free articles / View paid articles |
Business | $980/month | View free articles / View paid articles / View business reports |
Creating products and entitlements
Stripe's API can be tested using the Workbench in the Stripe dashboard. Workbench allows you to perform development, testing, and debugging all within the browser without installing any software or browser extensions. Open the workbench and navigate to the Shell tab, where you can run Stripe's CLI.
To create the pricing plans, run:
stripe products create --name="Free" \ -d "default_price_data[currency]=usd" \ -d "default_price_data[unit_amount]=0" \ -d "default_price_data[recurring][interval]=month" stripe products create --name="Personal" \ -d "default_price_data[currency]=usd" \ -d "default_price_data[unit_amount]=9800" \ -d "default_price_data[recurring][interval]=month" stripe products create --name="Business" \ -d "default_price_data[currency]=usd" \ -d "default_price_data[unit_amount]=98000" \ -d "default_price_data[recurring][interval]=month"
This returns a JSON response with an id starting with prod_ which means the creation succeeded. The command's output is also reflected in the API Explorer on the right.
You can also convert the CLI command into code using the SDK of the specified language by clicking the Print SDK request link.
By using the Shell tab's functions, you can check the operation of the Stripe API and create implementation code in the following flow:
1: Copy the CLI command described in the documentation or tutorial.
2: Paste the CLI command into the Shell tab of the Workbench.
3: Execute the CLI command and check the implementation method and the created resources.
4: Change the values displayed in the API Explorer and consider how to realize the settings you want to build.
5: Convert the CLI command or the contents set in the API Explorer into source code with Print SDK request.
6: Incorporate the created source code into your application.
Setting up access permissions
When managing access permissions with Stripe, first create Entitlements resources using the Entitlements API. Here, you prepare three Entitlements: viewing free articles, viewing paid articles, and viewing business reports.
To set this up, run the following commands in the Shell tab:
stripe entitlements features create \ --lookup-key="free_posts" \ --name="Free article viewing" stripe entitlements features create \ --lookup-key="paid_posts" \ --name="Paid article viewing" stripe entitlements features create \ --lookup-key="biz_reports" \ --name="Business report viewing"
Registering the created Entitlements with the pricing plan
By associating Stripe Products and Entitlements, you can obtain a list of Entitlements owned by customers based on the information of the Products the customers have subscribed to. To register Entitlements for each Product, run the command using the Product ID you created earlier, which starts with `prod_`, and the Entitlements ID, which starts with `feat_`.
Product ID of Free:
stripe product_features create \ "Product ID of Free" \ --entitlement-feature="Feature ID of Free article viewing"
Product ID of Personal:
stripe product_features create \ "Product ID of Personal" \ --entitlement-feature="Feature ID of Free article viewing" stripe product_features create \ "Product ID of Personal" \ --entitlement-feature="Feature ID of Paid article viewing"
Product ID of Business:
stripe product_features create \ "Product ID of Business" \ --entitlement-feature="Feature ID of Free article viewing" stripe product_features create \ "Product ID of Business" \ --entitlement-feature="Feature ID of Paid article viewing" stripe product_features create \ "Product ID of Business" \ --entitlement-feature="Feature ID of Business report viewing"
This completes the linking of plans and Entitlements. You can now use the product ID to obtain a list of Entitlements available for each pricing plan from the API.
Creating a new subscription
To create a new subscription, use the dashboard or Checkout and Payment Links. When a customer purchases a subscription, a list of Entitlements associated with the subscribed product can be obtained via an API request using the Customer ID. Your application can use the response from this API to determine whether specific features are available to the customer.
stripe entitlements active_entitlements list \ --customer="customer ID starting with cus_" \ --expand "data.feature"
This API checks permissions across multiple subscriptions. Even if you are considering a pricing structure for a service that offers optional plans with additional features on top of the basic plan, you can still manage permissions using the Entitlements API.
This allows you to create pricing plans and products in Stripe, and connect them to lists of access permissions. You can also obtain a list of permissions for each user easily.
Access permission changes are synced with the application via webhooks
Some services may need to execute a workflow if permissions are granted or revoked, such as when there are changes to infrastructure configurations or system settings. These types of changes in permissions can also be integrated using Stripe's webhook events.
To handle permission changes associated with plan changes or cancellations, use the newly added entitlements.active_entitlement_summary.updated event. This event includes information such as the "target customer ID" and "before and after permission settings".
{ "object": { "object": "entitlements.active_entitlement_summary", "customer": "cus_OYXmEvKfYDp7DA", "entitlements": { "object": "list", "data": [], "has_more": false, "url": "/v1/customer/cus_OYXmEvKfYDp7DA/entitlements" }, "livemode": false }, "previous_attributes": { "entitlements": { "data": [ { "id": "ent_test_61QSA7cL7mjHYxePl41IDF6qBhttt65Y", "object": "entitlements.active_entitlement", "feature": "feat_test_61QS9o4tAnK9ATPJX41IDF6qBhttt7Cq", "livemode": false, "lookup_key": "paid_posts" }, { "id": "ent_test_61QSA7cYW9h6XG8zt41IDF6qBhttt27s", "object": "entitlements.active_entitlement", "feature": "feat_test_61QS9nd2kxnCe1ksR41IDF6qBhttt6Ui", "livemode": false, "lookup_key": "free_posts" } ] } } }
Using this data, you can set up configurations with logic like "if there are permissions that only exist in previous_attributes, execute a workflow that modifies related resources or the database."
Conclusion
In developing a Software as a Service (SaaS) product, many things must be created in addition to the core functions of the service. These include authentication and billing payment functions, as well as the definition and assignment of access rights for each user—a crucial aspect of monetizing a service, as introduced in this article. To focus resources on the development and maintenance of functions that are the core value of the service, these functions should be implemented efficiently and with minimal code.
Stripe's Entitlement API is a new solution to address these challenges for service developers. By managing the list of functions provided to customers on Stripe, you can also manage which functions are granted access rights for each fee plan presented to users. Furthermore, by consolidating the feature list on Stripe, you can easily offer special plans to important customers and heavy users by creating dedicated products and rates and assigning Entitlement to them.
In addition, changes to subscription plans, price revisions, and system changes due to the release of new features can be synchronized using the Webhook events provided by Stripe. To try out these features or validate the data sent by the webhook event, use the Workbench feature built into the dashboard.
To learn more about developing applications with Stripe, visit our YouTube Channel.