Documentation
¶
Index ¶
- type BillingSvc
- type BillingSvcConfig
- type CreateBillingPortalSessionEndpoint
- type CreateEnterpriseInquiryEndpoint
- type EnsureBillingCustomerEndpoint
- type GetAccountUsageEndpoint
- type GetPlanChangePreviewEndpoint
- type GetPlanProrationRequest
- type GetPricingPlansEndpoint
- type GetSpendingCapEndpoint
- type SetSpendingCapEndpoint
- type SetSpendingCapRequest
- type SwitchPlanEndpoint
- type SwitchPlanRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BillingSvc ¶
type BillingSvc interface {
GetPricingPlans(ctx context.Context, req *apiresource.PaginationRequest) (*apiresource.List[apiresource.PricingPlan], *apierror.APIError)
GetAccountUsage(ctx context.Context, req *apiresource.EmptyResource) (*apiresource.AccountUsageResponse, *apierror.APIError)
CreateBillingPortalSession(ctx context.Context, req *apiresource.EmptyResource) (*apiresource.BillingPortalSessionResponse, *apierror.APIError)
GetPlanChangePreview(ctx context.Context, req *GetPlanProrationRequest) (*apiresource.PlanChangeProration, *apierror.APIError)
CreateEnterpriseInquiry(ctx context.Context, req *apiresource.EmptyResource) (*apiresource.EnterpriseInquiry, *apierror.APIError)
EnsureBillingCustomer(ctx context.Context, req *apiresource.EmptyResource) (*apiresource.EnsureBillingCustomerResponse, *apierror.APIError)
SwitchPlan(ctx context.Context, req *SwitchPlanRequest) (*apiresource.SwitchPlanResponse, *apierror.APIError)
GetSpendingCap(ctx context.Context, req *apiresource.EmptyResource) (*apiresource.SpendingCapResponse, *apierror.APIError)
SetSpendingCap(ctx context.Context, req *SetSpendingCapRequest) (*apiresource.SpendingCapResponse, *apierror.APIError)
}
func NewBillingSvc ¶
func NewBillingSvc(config *BillingSvcConfig) BillingSvc
type BillingSvcConfig ¶
type BillingSvcConfig struct {
// BillingClient (required) is the billing-service gRPC client.
BillingClient pb.BillingServiceClient
// CoreClient (required) is the core-service gRPC client.
CoreClient corepb.CoreServiceClient
}
type CreateBillingPortalSessionEndpoint ¶
type CreateBillingPortalSessionEndpoint struct{}
Creates a Stripe billing portal session for the account and returns the URL to send an admin to.
The portal is where the account manages payment methods, invoices, and its subscription directly in Stripe. The account must already have a Stripe customer; create one with Ensure Billing Customer first.
func (*CreateBillingPortalSessionEndpoint) Materialize ¶
func (e *CreateBillingPortalSessionEndpoint) Materialize() *apiendpoint.APIEndpoint[*apiresource.EmptyResource, *apiresource.BillingPortalSessionResponse]
type CreateEnterpriseInquiryEndpoint ¶
type CreateEnterpriseInquiryEndpoint struct{}
Asks the OpenMRP sales team to get in touch about an enterprise plan.
The account, its current plan, and the requesting user's name and email are sent to sales for follow-up. Nothing about the account's plan, subscription, or billing changes.
func (*CreateEnterpriseInquiryEndpoint) Materialize ¶
func (e *CreateEnterpriseInquiryEndpoint) Materialize() *apiendpoint.APIEndpoint[*apiresource.EmptyResource, *apiresource.EnterpriseInquiry]
type EnsureBillingCustomerEndpoint ¶
type EnsureBillingCustomerEndpoint struct{}
Ensures a Stripe billing customer exists for the account, creating one if necessary.
A new customer is created from the account's name and the email address of one of its admin users. Calling this repeatedly is safe: an account that already has a Stripe customer gets that customer back untouched.
func (*EnsureBillingCustomerEndpoint) Materialize ¶
func (e *EnsureBillingCustomerEndpoint) Materialize() *apiendpoint.APIEndpoint[*apiresource.EmptyResource, *apiresource.EnsureBillingCustomerResponse]
type GetAccountUsageEndpoint ¶
type GetAccountUsageEndpoint struct{}
Returns the account's resource usage against its plan limits, along with subscription status, plan pricing, and estimated agent spending.
Seats and sandboxes are current totals, while invoices and batches are counted from the start of the current billing period. The plan name and base fee come from the pricing plan configured in Stripe, so they can differ from the name and price the same plan advertises on the pricing page.
func (*GetAccountUsageEndpoint) Materialize ¶
func (e *GetAccountUsageEndpoint) Materialize() *apiendpoint.APIEndpoint[*apiresource.EmptyResource, *apiresource.AccountUsageResponse]
type GetPlanChangePreviewEndpoint ¶
type GetPlanChangePreviewEndpoint struct{}
Returns what it would cost to switch the account to a different pricing plan.
The preview covers the prorated amount due now and the estimated recurring monthly bill afterwards. Nothing is charged and the subscription is left unchanged. Amounts are quoted by Stripe where possible; when Stripe cannot quote the change, OpenMRP estimates them and flags the result with `is_estimate`. A switch to the free plan always previews as zero.
func (*GetPlanChangePreviewEndpoint) Materialize ¶
func (e *GetPlanChangePreviewEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetPlanProrationRequest, *apiresource.PlanChangeProration]
type GetPlanProrationRequest ¶
type GetPlanProrationRequest struct {
// ID of the plan the account would switch to.
PlanID string `path:"id" validate:"required"`
}
Request to preview the cost of a plan change.
type GetPricingPlansEndpoint ¶
type GetPricingPlansEndpoint struct{}
Returns the pricing plans an account can sign up for, with their limits and marketing copy.
Only publicly listed plans that are currently in effect are returned, so privately negotiated and retired plans never appear here.
func (*GetPricingPlansEndpoint) Materialize ¶
func (e *GetPricingPlansEndpoint) Materialize() *apiendpoint.APIEndpoint[*apiresource.PaginationRequest, *apiresource.List[apiresource.PricingPlan]]
type GetSpendingCapEndpoint ¶
type GetSpendingCapEndpoint struct{}
Returns the monthly cap on agent spending for the account.
The cap limits estimated agent LLM spend within a billing month; Get Account Usage reports how much of it has been spent so far.
func (*GetSpendingCapEndpoint) Materialize ¶
func (e *GetSpendingCapEndpoint) Materialize() *apiendpoint.APIEndpoint[*apiresource.EmptyResource, *apiresource.SpendingCapResponse]
type SetSpendingCapEndpoint ¶
type SetSpendingCapEndpoint struct{}
Sets or removes the monthly agent spending cap for the account.
When estimated agent spend reaches the cap, new agent runs are blocked and in-progress runs are stopped until the cap is raised, removed, or the next billing month begins.
func (*SetSpendingCapEndpoint) Materialize ¶
func (e *SetSpendingCapEndpoint) Materialize() *apiendpoint.APIEndpoint[*SetSpendingCapRequest, *apiresource.SpendingCapResponse]
type SetSpendingCapRequest ¶
type SetSpendingCapRequest struct {
// Ceiling in cents on estimated agent spending per billing month.
//
// Send `null` to remove the cap entirely; omit the field to leave the current cap unchanged.
CapCents field.Clearable[int64] `json:"cap_cents,omitzero"`
}
Request to set or remove the monthly spending cap.
func (*SetSpendingCapRequest) SchemaExample ¶
func (*SetSpendingCapRequest) SchemaExample() any
type SwitchPlanEndpoint ¶
type SwitchPlanEndpoint struct{}
Switches the account to a different pricing plan, effective immediately.
Free-to-paid, paid-to-free, and paid-to-paid changes are all handled: moving to the free plan cancels the current subscription, while moving to a paid plan subscribes the account at no fewer seats than that plan's seat minimum. A change that owes a prorated amount is charged straight away to the account's payment method on file, so use Preview Plan Change first to see the cost. Moving to a paid plan requires the account to already have a Stripe customer and billing profile.
func (*SwitchPlanEndpoint) Materialize ¶
func (e *SwitchPlanEndpoint) Materialize() *apiendpoint.APIEndpoint[*SwitchPlanRequest, *apiresource.SwitchPlanResponse]
type SwitchPlanRequest ¶
type SwitchPlanRequest struct {
// ID of the plan to move the account onto.
PlanID string `path:"id" validate:"required"`
}
Request to switch pricing plans.