Skip to content

Commit bf1f783

Browse files
Merge pull request #460 from kinde-oss/Feat/Update-Billing-docs
Feat/metered charges and url changes for billing
2 parents eff0891 + 7aab49c commit bf1f783

File tree

6 files changed

+149
-4
lines changed

6 files changed

+149
-4
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
page_id: db047df7-d6b6-4d02-843f-dce6000bacbd
3+
title: Update code and URLs for billing
4+
sidebar:
5+
order: 3
6+
relatedArticles:
7+
- bd6757e3-81d5-48d6-89c8-dd4c222ac647
8+
- 100f75f1-a0a4-459f-874f-da127f2d0615
9+
---
10+
11+
This topic explains how to customize billing flows with Kinde, including URL parameters, direct auth URLs, and SDK usage in React.
12+
13+
Examples are given in React, but can be adapted for most frameworks.
14+
15+
## Edit the auth URL parameters directly
16+
17+
Here’s a standard Kinde auth URL:
18+
19+
```
20+
21+
https://<your_kinde_subdomain>.kinde.com/oauth2/auth
22+
?response_type=code
23+
&client_id=<your_kinde_client_id>
24+
&redirect_uri=<your_app_redirect_url>
25+
&scope=openid%20profile%20email
26+
&state=abc
27+
28+
```
29+
30+
Add these parameters as needed:
31+
32+
| Parameter | Description |
33+
| --- | --- |
34+
| `plan_interest` | Pre-selects a plan (skips plan selection) |
35+
| `pricing_table_key` | Displays a specific pricing table |
36+
| `is_create_org` | Triggers org sign-up flow |
37+
38+
### Examples
39+
40+
- Pre-select a plan:
41+
42+
```
43+
...&plan_interest=pro_monthly
44+
```
45+
46+
- Show specific pricing:
47+
48+
```
49+
...&pricing_table_key=spring_promo
50+
```
51+
52+
- Org sign-up:
53+
54+
```
55+
...&is_create_org=true
56+
```
57+
58+
## Integrate billing using the React SDK
59+
60+
You can avoid manual URL construction by using our SDK components. Here's how.
61+
62+
**User sign-up (default):**
63+
64+
```jsx
65+
<RegisterLink>Sign up</RegisterLink>
66+
```
67+
68+
**Org sign-up (B2B):**
69+
70+
```jsx
71+
<RegisterLink isCreateOrg>Sign up your organization</RegisterLink>
72+
```
73+
74+
**Pre-select a user plan:**
75+
76+
```jsx
77+
<RegisterLink planInterest="pro_monthly">Sign up with Pro plan</RegisterLink>
78+
```
79+
80+
**Show a specific pricing table:**
81+
82+
```jsx
83+
<RegisterLink pricingTableKey="spring_promo">Spring Promo Sign up</RegisterLink>
84+
```
85+
86+
**Combine for B2B + pricing table:**
87+
88+
```jsx
89+
<RegisterLink isCreateOrg pricingTableKey="enterprise_2024">
90+
Sign up your company
91+
</RegisterLink>
92+
```

src/content/docs/billing/billing-user-experience/plan-selection.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,7 @@ You can configure Kinde to hide pricing tables in the sign up flow, but still sh
119119
1. Go to **Settings > Environment > Billing**.
120120
2. Switch off the **Show the pricing table when customers sign up** option.
121121
3. Select **Save**.
122+
123+
## Add plan selector to registration URL
124+
125+
Use your SDK or manually change URL params to incorporate billing. See [Add billing to URl or SDK](/billing/billing-user-experience/add-billing-to-url-sdk/)

src/content/docs/billing/get-started/setup-overview.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ Billing is big step for a business, so it’s a good idea to review the process
1616
## Overview of billing setup
1717

1818
1. [Set up billing roles and permissions (B2B)](/billing/get-started/add-billing-role/)
19-
2. [Set currency](/billing/get-started/default-billing-currency/) - you can’t change this once your first plan is published
20-
3. [Connect to Stripe](/billing/get-started/connect-to-stripe/)
19+
2. [Connect to Stripe and set billing policies](/billing/get-started/connect-to-stripe/)
20+
3 [Set currency](/billing/get-started/default-billing-currency/) - you can’t change this once your first plan is published
2121
4. [Build plans](/billing/manage-plans/create-plans/)
2222
5. [Publish plans](/billing/get-started/publish-plans/)
2323
6. Enable subscription self-serve (optional)
2424
1. [Create a plan selector](/billing/billing-user-experience/plan-selection/)
2525
2. [Enable self-serve portal](/build/set-up-options/self-serve-portal-for-orgs/)
26-
7. Update your code
26+
7. [Update your code and registration URLs](/billing/billing-user-experience/add-billing-to-url-sdk/)
2727
8. Test the setup and get your first subscriber!
2828

2929
## ⚠️ Test in a non-production environment
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
page_id: 7060212e-5e8c-4188-acd3-e055e3474988
3+
title: Add metered usage for a customer via API
4+
sidebar:
5+
order: 1
6+
relatedArticles:
7+
- 7f59a705-ac5d-4b07-a44e-1421dcdeffe8
8+
---
9+
10+
From time to time, you may need to manually add metered usage for an individual customer. You can do this via the Kinde API.
11+
12+
Adding usage values requires two key pieces of information:
13+
14+
- your customer's agreement ID
15+
- the feature code you want to record usage against
16+
17+
## Get the agreement ID
18+
19+
- [Via API](https://docs.kinde.com/kinde-apis/management/#tag/billing-agreements/get/api/v1/billing/agreements/). Include the `billing` expand parameter in your request to access the agreement ID.
20+
21+
- Via the Kinde UI - Open the user or organization record in Kinde and select **Billing** in the menu. The customer agreement shows as part of the subscription details.
22+
23+
## Get the feature ID
24+
25+
1. Open the plan the feature belongs to.
26+
2. Edit the feature (to view it) in the plan.
27+
3. Take note of the **Key**.
28+
29+
## Submit usage data
30+
31+
POST the usage to the [meter usage record API](https://docs.kinde.com/kinde-apis/management/#tag/billing-meter-usage/post/api/v1/billing/meter_usage/) including the feature code and agreement ID to record a usage value.
32+
33+
<Aside>
34+
35+
Usage gets assigned to your customer's current billing cycle. Any usage submitted after a billing cycle ends will be recorded against the next billing cycle.
36+
37+
</Aside>

src/content/docs/billing/pricing/pricing-models.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ sidebar:
66
relatedArticles:
77
- fe9fea0c-274c-4d6b-9cc5-eccdbaad85b7
88
- d980a089-d9c1-447b-930a-de0f2c00d3bf
9+
- 7060212e-5e8c-4188-acd3-e055e3474988
910
---
1011

1112
A pricing model refers to the structured approach businesses use to charge customers for products and services, often based on factors like usage, feature access, or licensing. In Kinde, each feature you include in a plan has a pricing model attached. This topic describes some examples of pricing models you can apply in Kinde, when you might want to use them, and how to [set them up in your Kinde plans](/billing/manage-plans/create-plans/).
@@ -22,10 +23,16 @@ In Kinde, create a **Fixed charge** and call it something like `Subscription fee
2223

2324
- Example - Basic plan 5.00, Team plan 20.00, Business plan 75.00.
2425

25-
## Usage-based pricing
26+
## Usage-based (metered) pricing
2627

2728
Where you charge customers for what they use. For example, monthly active users, data storage, transactions, etc. For each individual plan you can treat this as fully pay-as-you-go, or charge volume prices so the price goes down the more units are used. You can set limits for usage based pricing or leave as limitless. Limits can make plan upgrade more attractive.
2829

30+
<Aside>
31+
32+
If you need to, you can [add metered amounts to individual customer plans via the Kinde API](/billing/manage-subscribers/add-metered-usage/).
33+
34+
</Aside>
35+
2936
### Usage pricing - per unit
3037

3138
In Kinde, add a **New metered feature**, e.g. `Data storage`. Leave **Maximum units** blank for limitless, or set a limit. Select a **per unit** pricing model. Set a price for each unit. E.g.

src/data/sidebarData.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ const sidebarData = [
162162
autogenerate: {directory: "billing/payment-management"},
163163
collapsed: false
164164
},
165+
{
166+
label: "Subscription management",
167+
autogenerate: {directory: "billing/manage-subscribers"},
168+
collapsed: false
169+
},
165170
{
166171
label: "Pricing",
167172
autogenerate: {directory: "billing/pricing"},

0 commit comments

Comments
 (0)