@lukoweb/apitogo 0.2.29 → 0.2.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -203,7 +203,8 @@ export interface ProjectSubscriptionDto {
203
203
  availableCurrencies: string[];
204
204
  }
205
205
  export interface CheckoutSessionResponse {
206
- url: string;
206
+ url: string | null;
207
+ granted?: boolean;
207
208
  }
208
209
  export interface DeploymentTokenResponse {
209
210
  token: string;
@@ -443,6 +444,12 @@ export interface ProjectIdentityRequestBody {
443
444
  portalRedirectUris: string[];
444
445
  nativeSignup?: boolean;
445
446
  }
447
+ export interface DevPortalBillingDto {
448
+ jobId: string;
449
+ mode: string;
450
+ webhookUrl: string;
451
+ hasWebhookSecret: boolean;
452
+ }
446
453
  export interface DevPortalIdentityLinkDto {
447
454
  jobId: string;
448
455
  }
@@ -525,6 +532,7 @@ export declare class PlatformApiClient {
525
532
  createCheckoutSession(projectId: string, body: {
526
533
  planSlug: string;
527
534
  currency?: string;
535
+ skipPayment?: boolean;
528
536
  }): Promise<CheckoutSessionResponse>;
529
537
  getLatestAzureInfrastructureStatus(projectId: string): Promise<DeployStatusResponse>;
530
538
  retryAzureInfrastructure(projectId: string): Promise<StartDeployResponse>;
@@ -560,6 +568,13 @@ export declare class PlatformApiClient {
560
568
  deleteProjectIdentityConnection(projectId: string, connectionId: string): Promise<void>;
561
569
  getProjectIdentity(projectId: string): Promise<ProjectIdentityDto | null>;
562
570
  deleteProjectIdentity(projectId: string): Promise<ProjectIdentityDto | null>;
571
+ putDevPortalBilling(projectId: string, body: {
572
+ provider: "stripe" | "none";
573
+ apiKey?: string;
574
+ webhookSecret?: string;
575
+ successUrl?: string;
576
+ cancelUrl?: string;
577
+ }): Promise<DevPortalBillingDto>;
563
578
  linkDevPortalIdentity(projectId: string): Promise<DevPortalIdentityLinkDto>;
564
579
  getDevPortalBackend(projectId: string): Promise<DevPortalBackendDto | null>;
565
580
  getDevPortalSetupStatus(projectId: string): Promise<DevPortalSetupStatusDto>;
@@ -3,7 +3,7 @@ import type { ProgressReporter } from "./progress.js";
3
3
  export declare function isPlatformPlanUnselected(planTier: string | undefined | null): boolean;
4
4
  export declare function isPlatformPlanSelected(subscription: ProjectSubscriptionDto): boolean;
5
5
  export declare function isPaidPlanTier(planTier: string): boolean;
6
- export declare function isPaidPlanActive(subscription: ProjectSubscriptionDto): boolean;
6
+ export declare function isPaidPlanActive(subscription: Pick<ProjectSubscriptionDto, "planTier" | "subscriptionLifecycle">): boolean;
7
7
  export declare function isPlatformPlanReady(subscription: ProjectSubscriptionDto): boolean;
8
8
  export interface PlatformPlanWaitResult {
9
9
  status: "succeeded" | "timeout" | "failed";
@@ -1,75 +1,132 @@
1
- ---
2
- title: CLI commands
3
- description: APItoGo CLI command catalog by category.
4
- sidebar_icon: wrench
5
- ---
6
-
7
- Commands are exposed by the **`apitogo`** binary (`@lukoweb/apitogo`). The CLI is the **source of
8
- truth** for init, config, deploy, status, teardown, project create, and check. MCP tools spawn these
9
- same commands so agents and humans get identical behavior.
10
-
11
- ## Lifecycle (prefer these)
12
-
13
- | Command | Role |
14
- | ---------------- | --------------------------------------------------------------------- |
15
- | `init` | Scaffold portal (default `./dev-portal`; OpenAPI discovery + secrets) |
16
- | `config` | Write or update `apitogo.config.json` (interactive or flags) |
17
- | `run` | Local preview server |
18
- | `build` | Production build (`--preview` to serve locally) |
19
- | `check` | Publish readiness (secrets, manifest, site validation) |
20
- | `project create` | Create a platform project (plan unselected) |
21
- | `deploy` | Publish config to platform (apihub + portal) |
22
- | `status` | Account, project, and live readiness |
23
- | `teardown --yes` | Delete the linked platform project |
24
-
25
- ## Scaffold and config
26
-
27
- | Command | Role |
28
- | ------------ | ----------------------------------------------------------------------------------------------------------- |
29
- | `init [dir]` | Folder (default `dev-portal`); `--name`, `--install` (default), `--overwrite`, `--json`, `--openapi-search` |
30
- | `config` | Interactive on TTY; flags: `--openapi`, `--page-*`, `--plan`, `--backend`, `--theme`, `--patch`, `--json` |
31
-
32
- `npx @lukoweb/apitogo@latest init` auto-wires nearby OpenAPI and `docs/`/`doc/` markdown after
33
- scaffold. See [Install the CLI](./setup.md#scaffold-options).
34
-
35
- See [Make config (CLI)](../configuration/make-config.mdx) for all `config` flags.
36
-
37
- ## Local development
38
-
39
- | Command | Role |
40
- | ----------------- | --------------------------------------------------------- |
41
- | `run` | Run the local portal server (`--port`, `--open`, `--ssr`) |
42
- | `build` | Production static build |
43
- | `build --preview` | Build then serve locally |
44
-
45
- ## Platform (requires API credentials)
46
-
47
- | Command | Role |
48
- | -------------------------- | -------------------------------------------------------------- |
49
- | `project create --name` | Create platform project only |
50
- | `check` | Dry-run publish readiness |
51
- | `deploy` | Full publish — project, plans, apihub, portal backend/frontend |
52
- | `deploy --only <resource>` | Limit to `apihub`, `portal-backend`, or `portal-frontend` |
53
- | `deploy --force` | Redeploy selected resources even when healthy |
54
- | `deploy --platform-plan` | Select Free / Starter / Professional hosting |
55
- | `deploy --resume-from` | Resume interrupted publish |
56
- | `status` | Whoami + project + live verification |
57
- | `teardown --yes` | Delete platform project (confirmation required) |
58
-
59
- Env: `APITOGO_API_KEY_ID`, `APITOGO_API_SECRET`. Optional: `APITOGO_API_URL`.
60
-
61
- ## Hand-edit exceptions
62
-
63
- | Change | Where |
64
- | ----------------- | -------------------------------------------------------- |
65
- | Home page content | `landing/LandingPage.tsx` |
66
- | Site footer | `apitogo.config.json` → `modules.landing.content.footer` |
67
-
68
- There is no CLI command for arbitrary home page content.
69
-
70
- ## Related
71
-
72
- - [Overview](./overview.md)
73
- - [Shape](./shape.md)
74
- - [Go live](./go-live.md)
75
- - [MCP tools](../mcp/tools.md) — agent tool catalog (spawn the CLI)
1
+ ---
2
+ title: CLI commands
3
+ description: APItoGo CLI command catalog by category.
4
+ sidebar_icon: wrench
5
+ ---
6
+
7
+ Commands are exposed by the **`apitogo`** binary (`@lukoweb/apitogo`). The CLI is the **source of
8
+ truth** for init, config, deploy, status, teardown, project create, and check. MCP tools spawn these
9
+ same commands so agents and humans get identical behavior.
10
+
11
+ ## Lifecycle (prefer these)
12
+
13
+ | Command | Role |
14
+ | ---------------- | ------------------------------------------------------------------------ |
15
+ | `init` | Scaffold portal (default `./dev-portal`; OpenAPI discovery + secrets) |
16
+ | `config` | Write or update `apitogo.config.json` (interactive or flags) |
17
+ | `run` | Local preview server |
18
+ | `build` | Production build (`--preview` to serve locally) |
19
+ | `check` | Publish readiness (secrets, manifest, site validation) |
20
+ | `project create` | Create the platform project (Free plan in version 2) and link the folder |
21
+ | `deploy` | Publish config to platform (apihub + portal) |
22
+ | `status` | Account, project, and live readiness |
23
+ | `teardown --yes` | Delete the linked platform project |
24
+
25
+ ## Scaffold and config
26
+
27
+ | Command | Role |
28
+ | ------------ | ----------------------------------------------------------------------------------------------------------- |
29
+ | `init [dir]` | Folder (default `dev-portal`); `--name`, `--install` (default), `--overwrite`, `--json`, `--openapi-search` |
30
+ | `config` | Interactive on TTY; flags: `--openapi`, `--page-*`, `--plan`, `--backend`, `--theme`, `--patch`, `--json` |
31
+
32
+ `npx @lukoweb/apitogo@latest init` auto-wires nearby OpenAPI and `docs/`/`doc/` markdown after
33
+ scaffold. See [Install the CLI](./setup.md#scaffold-options).
34
+
35
+ See [Make config (CLI)](../configuration/make-config.mdx) for all `config` flags.
36
+
37
+ ## Local development
38
+
39
+ | Command | Role |
40
+ | ----------------- | --------------------------------------------------------- |
41
+ | `run` | Run the local portal server (`--port`, `--open`, `--ssr`) |
42
+ | `build` | Production static build |
43
+ | `build --preview` | Build then serve locally |
44
+
45
+ ## Platform (requires API credentials)
46
+
47
+ | Command | Role |
48
+ | -------------------------- | -------------------------------------------------------------------------------------------------------- |
49
+ | `project create` | Create the platform project only; version 2 also selects Free, waits for hosting and writes `project.id` |
50
+ | `check` | Dry-run publish readiness |
51
+ | `deploy` | Full publish — project, plans, apihub, portal backend/frontend |
52
+ | `deploy --only <resource>` | Limit to `apihub`, `portal-backend`, or `portal-frontend` |
53
+ | `deploy --force` | Redeploy selected resources even when healthy |
54
+ | `deploy --platform-plan` | Select Free / Starter / Professional hosting |
55
+ | `deploy --resume-from` | Resume interrupted publish |
56
+ | `status` | Whoami + project + live verification |
57
+ | `teardown --yes` | Delete platform project (confirmation required) |
58
+
59
+ Env: `APITOGO_API_KEY_ID`, `APITOGO_API_SECRET`. Optional: `APITOGO_API_URL`.
60
+
61
+ ## Config version 2: create the project, then deploy
62
+
63
+ ```bash
64
+ npx apitogo project create
65
+ npx apitogo deploy
66
+ ```
67
+
68
+ `project create` makes the platform project, selects the **Free** plan (or the plan from `--plan`),
69
+ waits for the hosting that the enabled services need, and writes `project.id` into
70
+ `apitogo.config.json`. `deploy` then publishes each service. It needs the project id from
71
+ `project.id`, from `--project-id`, or from `APITOGO_DEFAULT_PROJECT_ID`, and says so when it has
72
+ none.
73
+
74
+ | `project create` option | In version 2 |
75
+ | ----------------------- | ------------------------------------------------------------------ |
76
+ | `--name` | Optional. Defaults to `project.name` |
77
+ | `--description` | Optional |
78
+ | `--plan` | `free` (default), `starter` or `professional`. See below |
79
+ | `--no-open` | Print the checkout link of a paid plan and do not open the browser |
80
+ | `--modules` | Ignored. The modules come from the config (the portal needs one) |
81
+ | `--no-wait` | Return before the hosting is ready |
82
+ | `--json` | Print raw JSON only |
83
+
84
+ | `deploy` option | In version 2 |
85
+ | ----------------- | ---------------------------------------------------------- |
86
+ | `--only` | `portal`, `gateway`, `identity`, `plans` (comma-separated) |
87
+ | `--env` | Static Web App environment (default: production) |
88
+ | `--force` | Redeploy even when nothing changed |
89
+ | `--resume-from` | Resume the publish ledger from a step id |
90
+ | `--no-wait` | Do not wait for long-running jobs |
91
+ | `--platform-plan` | Ignored. The plan is chosen by `project create --plan` |
92
+ | `--project-name` | Ignored. The name is `project.name` |
93
+
94
+ ### Selling paid plans needs Starter or Professional
95
+
96
+ A project on the **Free** platform plan can only publish free plans, and its limits are capped. To
97
+ charge your customers, create the project on a paid platform plan:
98
+
99
+ ```bash
100
+ npx apitogo project create --plan starter
101
+ ```
102
+
103
+ The command makes the project, then prints a link to the platform's own checkout (and opens it in
104
+ your browser). You pay there, and the command waits until the payment is confirmed (up to 15
105
+ minutes) before it waits for the hosting. If it stops early, run the same command again: it
106
+ continues the same project and does not start a second checkout. With `--json` the command prints
107
+ the link and exits, and a later run continues.
108
+
109
+ Only a **new** project can be created on a paid plan. A project that is already on the Free plan, or
110
+ on the other paid plan, is not moved: create a new project in a new folder, or change the plan in
111
+ the web app.
112
+
113
+ This is what you pay APItoGo for hosting. What your customers pay you for your plans is separate
114
+ (see `plans.billing` in the config).
115
+
116
+ See [Walkthrough: from an empty folder to a customer's first call](./walkthrough.md).
117
+
118
+ ## Hand-edit exceptions
119
+
120
+ | Change | Where |
121
+ | ----------------- | -------------------------------------------------------- |
122
+ | Home page content | `landing/LandingPage.tsx` |
123
+ | Site footer | `apitogo.config.json` → `modules.landing.content.footer` |
124
+
125
+ There is no CLI command for arbitrary home page content.
126
+
127
+ ## Related
128
+
129
+ - [Overview](./overview.md)
130
+ - [Shape](./shape.md)
131
+ - [Go live](./go-live.md)
132
+ - [MCP tools](../mcp/tools.md) — agent tool catalog (spawn the CLI)
@@ -1,123 +1,135 @@
1
- ---
2
- title: Go live with CLI
3
- description:
4
- Publish an APIToGo developer portal with npx apitogo deploy — platform plans, secrets, and status.
5
- sidebar_icon: rocket
6
- ---
7
-
8
- **Go live** publishes your shaped portal to APItoGo hosting, optionally deploys the backend, upserts
9
- gateway plans, and verifies the live site. `npx apitogo deploy` is the source of truth; MCP
10
- `publish_dev_portal` spawns the same CLI.
11
-
12
- ## Before you publish
13
-
14
- 1. Confirm **gateway / API plans** in `apitogo.config.json`. Do not invent Free + Pro unless you
15
- chose them.
16
- 2. Save secrets in the site **`.env`** (never commit or paste into tickets):
17
-
18
- ```sh
19
- APITOGO_CONFIG_AUTHENTICATION__OIDC__AUTHORITY=https://login.example.com
20
- APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_ID=your-client-id
21
- APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_SECRET=your-client-secret
22
- # Only when you have paid project plans:
23
- APITOGO_CONFIG_AUTHENTICATION__STRIPE__SECRET_KEY=sk_test_...
24
- APITOGO_CONFIG_AUTHENTICATION__STRIPE__WEBHOOK_SECRET=whsec_...
25
- ```
26
-
27
- 3. Export platform credentials and choose a **platform hosting** plan: **Free**, **Starter**, or
28
- **Professional**. Starter and Professional use Stripe checkout on the platform.
29
-
30
- **Free** cannot publish **paid gateway plans** (`priceAmount > 0`) or attach a **custom domain**.
31
- If your manifest has paid API tiers, use Starter or Professional — see
32
- [Gateway plans](../configuration/plans.md).
33
-
34
- ```bash
35
- export APITOGO_API_KEY_ID=apk_...
36
- export APITOGO_API_SECRET=...
37
- ```
38
-
39
- ## Happy path
40
-
41
- ```bash
42
- cd ./dev-portal
43
- npx apitogo deploy --platform-plan free
44
- npx apitogo status
45
- ```
46
-
47
- `npx apitogo deploy`:
48
-
49
- - Creates or links the platform project
50
- - Provisions modules and syncs gateway plans
51
- - Deploys the API hub (when configured)
52
- - Updates the portal backend (including auth API URL in `.env`) and builds + deploys the portal
53
- frontend
54
-
55
- If deploy is blocked, fix the reported checklist (missing secrets, plan, OpenAPI). Do not invent
56
- credentials.
57
-
58
- After success, register **`manualSteps.oidcRedirectUri`** in your IdP. When Stripe is required for
59
- paid gateway plans, create a webhook at `manualSteps.stripeWebhookUrl` for the listed events.
60
-
61
- Do not treat warm-pool URLs as live until deploy and status succeed.
62
-
63
- ## Target specific resources
64
-
65
- ```bash
66
- npx apitogo deploy --only apihub
67
- npx apitogo deploy --only portal-backend
68
- npx apitogo deploy --only portal-frontend
69
- npx apitogo deploy --only apihub,portal-frontend
70
- npx apitogo deploy --only portal-frontend --force
71
- ```
72
-
73
- | Resource | What it updates |
74
- | ----------------- | ------------------------------------------------ |
75
- | `apihub` | Gateway plans/baseline, API hub package + deploy |
76
- | `portal-backend` | Dev-portal module settings and plan catalog |
77
- | `portal-frontend` | Site build + Static Web App deploy |
78
-
79
- Omit `--only` to apply all three. Use `--force` to redeploy even when hashes match.
80
-
81
- ## Other deploy flags
82
-
83
- | Flag | Purpose |
84
- | ----------------- | ------------------------------------- |
85
- | `--project-id` | Override project GUID |
86
- | `--project-name` | Display name when creating a project |
87
- | `--platform-plan` | `free` \| `starter` \| `professional` |
88
- | `--resume-from` | Resume publish ledger from step id |
89
- | `--no-wait` | Do not wait for long-running jobs |
90
- | `--json` | Print raw JSON result only |
91
-
92
- Resume state is stored in `.apitogo/publish-state.json`.
93
-
94
- ## After publish
95
-
96
- ```bash
97
- npx apitogo status # account + project + live checks
98
- npx apitogo status --skip-live # skip live health probes
99
- npx apitogo teardown --yes # delete the platform project
100
- ```
101
-
102
- ## Platform plan vs API plans
103
-
104
- | Kind | Meaning | How |
105
- | ---------------- | ------------------------------------------- | ------------------------------------------------------------------ |
106
- | Platform hosting | Free / Starter / Professional on APItoGo | `--platform-plan` |
107
- | Gateway / API | End-user SKUs and rate limits on `/pricing` | `apitogo.config.json` — [Gateway plans](../configuration/plans.md) |
108
-
109
- ## CLI deploy vs MCP publish
110
-
111
- | Path | Use when |
112
- | ------------------------ | -------------------------------------------- |
113
- | `npx apitogo deploy` | Terminal, CI, scripts — full product go-live |
114
- | MCP `publish_dev_portal` | Agent-driven go-live with the same engine |
115
-
116
- ## Related
117
-
118
- - [Shape](./shape.md)
119
- - [Commands](./commands.md)
120
- - [Authentication](../configuration/authentication.md)
121
- - [Manifest](../configuration/manifest.md)
122
- - [Gateway plans](../configuration/plans.md)
123
- - [MCP go live](../mcp/go-live.md)
1
+ ---
2
+ title: Go live with CLI
3
+ description:
4
+ Publish an APIToGo developer portal with npx apitogo deploy — platform plans, secrets, and status.
5
+ sidebar_icon: rocket
6
+ ---
7
+
8
+ **Go live** publishes your shaped portal to APItoGo hosting, optionally deploys the backend, upserts
9
+ gateway plans, and verifies the live site. `npx apitogo deploy` is the source of truth; MCP
10
+ `publish_dev_portal` spawns the same CLI.
11
+
12
+ :::note
13
+
14
+ This page describes **config version 1** projects (the older `dev-portal` scaffold). A config
15
+ version 2 project, which `npx @lukoweb/apitogo@latest init` creates by default, is published
16
+ differently: run `npx apitogo project create`, then `npx apitogo deploy`. Its resources are
17
+ `portal`, `gateway`, `identity` and `plans`, and the options `--platform-plan` and `--project-name`
18
+ do not apply. See [Walkthrough: from an empty folder to a customer's first call](./walkthrough.md)
19
+ and
20
+ [Config version 2: create the project, then deploy](./commands.md#config-version-2-create-the-project-then-deploy).
21
+
22
+ :::
23
+
24
+ ## Before you publish
25
+
26
+ 1. Confirm **gateway / API plans** in `apitogo.config.json`. Do not invent Free + Pro unless you
27
+ chose them.
28
+ 2. Save secrets in the site **`.env`** (never commit or paste into tickets):
29
+
30
+ ```sh
31
+ APITOGO_CONFIG_AUTHENTICATION__OIDC__AUTHORITY=https://login.example.com
32
+ APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_ID=your-client-id
33
+ APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_SECRET=your-client-secret
34
+ # Only when you have paid project plans:
35
+ APITOGO_CONFIG_AUTHENTICATION__STRIPE__SECRET_KEY=sk_test_...
36
+ APITOGO_CONFIG_AUTHENTICATION__STRIPE__WEBHOOK_SECRET=whsec_...
37
+ ```
38
+
39
+ 3. Export platform credentials and choose a **platform hosting** plan: **Free**, **Starter**, or
40
+ **Professional**. Starter and Professional use Stripe checkout on the platform.
41
+
42
+ **Free** cannot publish **paid gateway plans** (`priceAmount > 0`) or attach a **custom domain**.
43
+ If your manifest has paid API tiers, use Starter or Professional — see
44
+ [Gateway plans](../configuration/plans.md).
45
+
46
+ ```bash
47
+ export APITOGO_API_KEY_ID=apk_...
48
+ export APITOGO_API_SECRET=...
49
+ ```
50
+
51
+ ## Happy path
52
+
53
+ ```bash
54
+ cd ./dev-portal
55
+ npx apitogo deploy --platform-plan free
56
+ npx apitogo status
57
+ ```
58
+
59
+ `npx apitogo deploy`:
60
+
61
+ - Creates or links the platform project
62
+ - Provisions modules and syncs gateway plans
63
+ - Deploys the API hub (when configured)
64
+ - Updates the portal backend (including auth API URL in `.env`) and builds + deploys the portal
65
+ frontend
66
+
67
+ If deploy is blocked, fix the reported checklist (missing secrets, plan, OpenAPI). Do not invent
68
+ credentials.
69
+
70
+ After success, register **`manualSteps.oidcRedirectUri`** in your IdP. When Stripe is required for
71
+ paid gateway plans, create a webhook at `manualSteps.stripeWebhookUrl` for the listed events.
72
+
73
+ Do not treat warm-pool URLs as live until deploy and status succeed.
74
+
75
+ ## Target specific resources
76
+
77
+ ```bash
78
+ npx apitogo deploy --only apihub
79
+ npx apitogo deploy --only portal-backend
80
+ npx apitogo deploy --only portal-frontend
81
+ npx apitogo deploy --only apihub,portal-frontend
82
+ npx apitogo deploy --only portal-frontend --force
83
+ ```
84
+
85
+ | Resource | What it updates |
86
+ | ----------------- | ------------------------------------------------ |
87
+ | `apihub` | Gateway plans/baseline, API hub package + deploy |
88
+ | `portal-backend` | Dev-portal module settings and plan catalog |
89
+ | `portal-frontend` | Site build + Static Web App deploy |
90
+
91
+ Omit `--only` to apply all three. Use `--force` to redeploy even when hashes match.
92
+
93
+ ## Other deploy flags
94
+
95
+ | Flag | Purpose |
96
+ | ----------------- | ------------------------------------- |
97
+ | `--project-id` | Override project GUID |
98
+ | `--project-name` | Display name when creating a project |
99
+ | `--platform-plan` | `free` \| `starter` \| `professional` |
100
+ | `--resume-from` | Resume publish ledger from step id |
101
+ | `--no-wait` | Do not wait for long-running jobs |
102
+ | `--json` | Print raw JSON result only |
103
+
104
+ Resume state is stored in `.apitogo/publish-state.json`.
105
+
106
+ ## After publish
107
+
108
+ ```bash
109
+ npx apitogo status # account + project + live checks
110
+ npx apitogo status --skip-live # skip live health probes
111
+ npx apitogo teardown --yes # delete the platform project
112
+ ```
113
+
114
+ ## Platform plan vs API plans
115
+
116
+ | Kind | Meaning | How |
117
+ | ---------------- | ------------------------------------------- | ------------------------------------------------------------------ |
118
+ | Platform hosting | Free / Starter / Professional on APItoGo | `--platform-plan` |
119
+ | Gateway / API | End-user SKUs and rate limits on `/pricing` | `apitogo.config.json` — [Gateway plans](../configuration/plans.md) |
120
+
121
+ ## CLI deploy vs MCP publish
122
+
123
+ | Path | Use when |
124
+ | ------------------------ | -------------------------------------------- |
125
+ | `npx apitogo deploy` | Terminal, CI, scripts — full product go-live |
126
+ | MCP `publish_dev_portal` | Agent-driven go-live with the same engine |
127
+
128
+ ## Related
129
+
130
+ - [Shape](./shape.md)
131
+ - [Commands](./commands.md)
132
+ - [Authentication](../configuration/authentication.md)
133
+ - [Manifest](../configuration/manifest.md)
134
+ - [Gateway plans](../configuration/plans.md)
135
+ - [MCP go live](../mcp/go-live.md)
@@ -108,7 +108,46 @@ What the gateway answers:
108
108
  The customer sees their calls on the **Usage** page. See
109
109
  [Your customers' account pages](../guides/customer-account.md).
110
110
 
111
- ## 5. Remove a test project
111
+ ## 5. Sell a paid plan (optional)
112
+
113
+ Free plans need no payment. To charge your customers, the project needs two things: a Starter or
114
+ Professional plan with APItoGo, and your own Stripe account. Your customers pay you, not APItoGo.
115
+
116
+ 1. Create the project on a paid platform plan: `npx apitogo project create --plan starter`. This
117
+ opens the platform's checkout for the hosting fee. A project that already exists on the Free plan
118
+ cannot be moved: create a new one. See
119
+ [Selling paid plans needs Starter or Professional](./commands.md#selling-paid-plans-needs-starter-or-professional).
120
+ 2. In your Stripe account, copy the secret key (it starts with `sk_test_` while you test). Store it
121
+ as a project secret. The command asks for the value, so it stays out of the config:
122
+
123
+ ```bash
124
+ npx apitogo secrets set STRIPE_KEY
125
+ ```
126
+
127
+ 3. Turn billing on in `apitogo.config.json`:
128
+
129
+ ```json
130
+ "plans": {
131
+ "billing": { "provider": "stripe", "apiKey": "secret:STRIPE_KEY" }
132
+ }
133
+ ```
134
+
135
+ 4. Give a plan a price in `plans.json`: `"priceAmount": 49`, `"priceCurrency": "usd"` and
136
+ `"billingPeriod": "month"`. Its limits cannot be higher than your platform plan allows. A plan
137
+ with a price is refused while billing is off, so nobody is offered a plan they cannot pay for.
138
+ 5. Deploy: `npx apitogo deploy`. The output says whether Stripe is in test or live mode and prints
139
+ your portal's webhook address.
140
+ 6. In Stripe, add that address as a webhook endpoint with the events `checkout.session.completed`,
141
+ `customer.subscription.updated`, `customer.subscription.deleted` and `invoice.payment_failed`.
142
+ Copy the signing secret (it starts with `whsec_`), store it with
143
+ `npx apitogo secrets set STRIPE_WEBHOOK`, add `"webhookSecret": "secret:STRIPE_WEBHOOK"` next to
144
+ `apiKey`, and deploy again. Until then a payment does not activate the plan, because the portal
145
+ cannot confirm it came from Stripe.
146
+
147
+ While you use a test key, pay with [Stripe's test cards](https://docs.stripe.com/testing). No real
148
+ money moves. Never type a live key until you have tested the whole path.
149
+
150
+ ## 6. Remove a test project
112
151
 
113
152
  ```bash
114
153
  npx apitogo teardown --yes
@@ -28,7 +28,27 @@ The plans come from `plans.json`. A plan has a name, limits, and optionally a pr
28
28
  subscribes to a plan and may hold more than one. Unsubscribing from a plan stops that plan's keys
29
29
  from working and keeps the customer's other plans.
30
30
 
31
- Free plans work without any payment. For paid plans see the `plans.billing` setting.
31
+ Free plans work without any payment. For paid plans see
32
+ [Sell a paid plan](../cli/walkthrough.md#5-sell-a-paid-plan-optional).
33
+
34
+ ### Paying for a plan
35
+
36
+ A plan with a price sends the customer to Stripe's checkout page. The portal never sees the card
37
+ details.
38
+
39
+ 1. The customer chooses the plan and pays on Stripe's page.
40
+ 2. Stripe returns the customer to **Billing**. The page says it is confirming the payment for a few
41
+ seconds, because Stripe tells the portal separately. Then the plan is active and the customer can
42
+ create a key for it.
43
+ 3. If the customer closes the checkout or goes back, the **Plans** page says checkout was cancelled
44
+ and nothing was charged.
45
+
46
+ If a payment fails, Stripe retries it. The subscription shows as past due. When Stripe finally
47
+ cancels it, the plan ends and its keys stop working with `401`. The customer is not moved to a free
48
+ plan on their own. They can subscribe to one on the **Plans** page.
49
+
50
+ What you see is in your own Stripe account: payments, customers and refunds. APItoGo does not take a
51
+ share and does not issue refunds. Tax, trials and refunds are not handled by the portal.
32
52
 
33
53
  ## API keys
34
54
 
@@ -59,9 +79,10 @@ the customer calls, those calls show as errors in the usage page.
59
79
 
60
80
  | What the customer sees | What to check |
61
81
  | --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
62
- | `401` with a key that should work | The key was revoked, or the plan was cancelled. Check the key on the API keys page. |
82
+ | `401` with a key that should work | The key was revoked, or the plan was cancelled or its payment ended. Check the API keys page. |
63
83
  | `401` on a project you set up by hand | `gateway.policies.access`: when it also requires a login token, a key alone is refused. |
64
84
  | `429` | The plan's limit was reached. The rate limit renews each period; the quota carries `Retry-After`. |
85
+ | A customer paid but has no plan | The webhook is missing or its signing secret is wrong. Check it in Stripe and in `plans.billing`. |
65
86
  | The usage page shows nothing after real calls | Calls only count when made with a key. Check that the gateway has been deployed with plans. |
66
87
  | Calls from the portal's own pages are blocked | Run `npx apitogo deploy` again. The gateway lists the portal's address after the portal exists. |
67
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",