You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api/pkg/server/admin_org_handlers.go
+56Lines changed: 56 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,69 @@
1
1
package server
2
2
3
3
import (
4
+
"encoding/json"
4
5
"net/http"
5
6
7
+
"github.com/gorilla/mux"
6
8
"github.com/helixml/helix/api/pkg/store"
7
9
"github.com/helixml/helix/api/pkg/types"
8
10
"github.com/rs/zerolog/log"
9
11
)
10
12
13
+
// SetOrgPlanRequest is the body for POST /admin/orgs/{id}/plan.
14
+
typeSetOrgPlanRequeststruct {
15
+
// Plan: "pro" | "free" forces the org's quota tier independent of Stripe
16
+
// (for customers who paid out-of-band). "" clears the override and reverts
17
+
// to the Stripe-derived tier.
18
+
Planstring`json:"plan"`
19
+
}
20
+
21
+
// adminSetOrgPlan godoc
22
+
// @Summary Set an organization's plan override (admin only)
23
+
// @Description Force an org's quota tier independent of Stripe — for customers who paid out-of-band. plan: "pro" | "free" | "" (clear). Never reverted by a Stripe webhook.
24
+
// @Tags organizations
25
+
// @Param id path string true "Organization ID"
26
+
// @Param request body SetOrgPlanRequest true "Plan override"
Msg("admin-stashed paid plan applied to first org wallet")
169
+
}
170
+
132
171
// adminActivateTrial godoc
133
172
// @Summary Activate a trial for a user (Admin, cloud only)
134
173
// @Description Stash a trial intent on the user, or immediately create a Stripe trial subscription on the user's oldest-owned org. Days defaults to 90; credits are taken verbatim from the request (0 means no admin top-up beyond what Stripe's subscription invoice contributes).
Copy file name to clipboardExpand all lines: api/pkg/server/docs.go
+61Lines changed: 61 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -743,6 +743,46 @@ const docTemplate = `{
743
743
}
744
744
}
745
745
},
746
+
"/api/v1/admin/orgs/{id}/plan": {
747
+
"post": {
748
+
"security": [
749
+
{
750
+
"BearerAuth": []
751
+
}
752
+
],
753
+
"description": "Force an org's quota tier independent of Stripe — for customers who paid out-of-band. plan: \"pro\" | \"free\" | \"\" (clear). Never reverted by a Stripe webhook.",
754
+
"tags": [
755
+
"organizations"
756
+
],
757
+
"summary": "Set an organization's plan override (admin only)",
758
+
"parameters": [
759
+
{
760
+
"type": "string",
761
+
"description": "Organization ID",
762
+
"name": "id",
763
+
"in": "path",
764
+
"required": true
765
+
},
766
+
{
767
+
"description": "Plan override",
768
+
"name": "request",
769
+
"in": "body",
770
+
"required": true,
771
+
"schema": {
772
+
"$ref": "#/definitions/server.SetOrgPlanRequest"
773
+
}
774
+
}
775
+
],
776
+
"responses": {
777
+
"200": {
778
+
"description": "OK",
779
+
"schema": {
780
+
"$ref": "#/definitions/types.Wallet"
781
+
}
782
+
}
783
+
}
784
+
}
785
+
},
746
786
"/api/v1/admin/users/{id}": {
747
787
"delete": {
748
788
"security": [
@@ -23094,6 +23134,10 @@ const docTemplate = `{
23094
23134
},
23095
23135
"days": {
23096
23136
"type": "integer"
23137
+
},
23138
+
"plan": {
23139
+
"description": "Plan selects what to grant. \"pro\" grants a PAID plan via a PlanOverride\n(no Stripe subscription) — for customers who paid out-of-band (bank\ntransfer). Empty or \"trial\" uses the Stripe trial path (Days applies).",
23140
+
"type": "string"
23097
23141
}
23098
23142
}
23099
23143
},
@@ -24970,6 +25014,15 @@ const docTemplate = `{
24970
25014
}
24971
25015
}
24972
25016
},
25017
+
"server.SetOrgPlanRequest": {
25018
+
"type": "object",
25019
+
"properties": {
25020
+
"plan": {
25021
+
"description": "Plan: \"pro\" | \"free\" forces the org's quota tier independent of Stripe\n(for customers who paid out-of-band). \"\" clears the override and reverts\nto the Stripe-derived tier.",
25022
+
"type": "string"
25023
+
}
25024
+
}
25025
+
},
24973
25026
"server.SharePointSiteResolveRequest": {
24974
25027
"type": "object",
24975
25028
"properties": {
@@ -36870,6 +36923,10 @@ const docTemplate = `{
36870
36923
"description": "PendingAdminCreditsOnFirstOrg holds credits stashed by admin via the\n/admin/users/{id}/credits endpoint when the user has no owned org yet.\nConsumed by consumeUserAdminCredits on first owned org, then cleared.\nKept separate from TrialCreditsOnFirstOrg so admins can comp credits\nwithout entangling the grant with trial-state UI or revocation flows.",
36871
36924
"type": "number"
36872
36925
},
36926
+
"plan_on_first_org": {
36927
+
"description": "PlanOnFirstOrg, when set (\"pro\"), grants a paid plan override to the\nuser's first owned org's wallet on creation — admin \"Activate\" with a\npaid (non-Stripe) plan for a user who has no org yet. Consumed alongside\nthe trial intent, then cleared.",
36928
+
"type": "string"
36929
+
},
36873
36930
"project_id": {
36874
36931
"description": "When running in Helix Code sandbox",
36875
36932
"type": "string"
@@ -37264,6 +37321,10 @@ const docTemplate = `{
37264
37321
"description": "If belongs to an organization",
37265
37322
"type": "string"
37266
37323
},
37324
+
"plan_override": {
37325
+
"description": "PlanOverride, when set (\"free\"|\"pro\"), forces the quota tier for this\nwallet regardless of the Stripe subscription — used to grant a paid plan\nto a customer who paid out-of-band (bank transfer, no card / no Stripe).\n\"\" means derive the tier from the Stripe subscription as usual. Stripe\nsync only ever writes the Subscription* fields, never this one, so an\nadmin grant can't be reverted by a webhook.",
0 commit comments