# Plans ## List `client.V1.Plans.List(ctx, query) (*CursorPage[V1PlanListResponse], error)` **get** `/v1/plans` List all available plans. ### Parameters - **query:** `V1PlanListParams` - **Limit:** `param.Field[int64]` Max number of results that should be returned - **NextPage:** `param.Field[string]` Cursor that indicates where the next page of results should start. ### Returns - Not supported - **ID:** `string` - **Description:** `string` - **Name:** `string` - **CustomFields:** `map[string, string]` ### Example ```go package main import ( "context" "fmt" "github.com/Metronome-Industries/metronome-go" "github.com/Metronome-Industries/metronome-go/option" ) func main() { client := metronome.NewClient( option.WithBearerToken("My Bearer Token"), ) page, err := client.V1.Plans.List(context.TODO(), metronome.V1PlanListParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` ## Get Details `client.V1.Plans.GetDetails(ctx, query) (*V1PlanGetDetailsResponse, error)` **get** `/v1/planDetails/{plan_id}` Fetch high level details of a specific plan. ### Parameters - **query:** `V1PlanGetDetailsParams` - **PlanID:** `param.Field[string]` ### Returns - Not supported - **Data:** `PlanDetail` ### Example ```go package main import ( "context" "fmt" "github.com/Metronome-Industries/metronome-go" "github.com/Metronome-Industries/metronome-go/option" ) func main() { client := metronome.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.V1.Plans.GetDetails(context.TODO(), metronome.V1PlanGetDetailsParams{ PlanID: metronome.F("d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` ## List Charges `client.V1.Plans.ListCharges(ctx, params) (*CursorPage[V1PlanListChargesResponse], error)` **get** `/v1/planDetails/{plan_id}/charges` Fetches a list of charges of a specific plan. ### Parameters - **params:** `V1PlanListChargesParams` - **PlanID:** `param.Field[string]` Path param: - **Limit:** `param.Field[int64]` Query param: Max number of results that should be returned - **NextPage:** `param.Field[string]` Query param: Cursor that indicates where the next page of results should start. ### Returns - Not supported - **ID:** `string` - **ChargeType:** `V1PlanListChargesResponseChargeType` - `V1PlanListChargesResponseChargeType` - `V1PlanListChargesResponseChargeType` - `V1PlanListChargesResponseChargeType` - `V1PlanListChargesResponseChargeType` - `V1PlanListChargesResponseChargeType` - **CreditType:** `CreditTypeData` - **CustomFields:** `map[string, string]` - **Name:** `string` - **Prices:** `[]V1PlanListChargesResponsePrice` - **Tier:** `float64` Used in pricing tiers. Indicates at what metric value the price applies. - **Value:** `float64` - **CollectionInterval:** `float64` - **CollectionSchedule:** `string` - **Quantity:** `float64` - **ProductID:** `string` - **ProductName:** `string` - **Quantity:** `float64` - **StartPeriod:** `float64` Used in price ramps. Indicates how many billing periods pass before the charge applies. - **TierResetFrequency:** `float64` Used in pricing tiers. Indicates how often the tier resets. Default is 1 - the tier count resets every billing period. - **UnitConversion:** `V1PlanListChargesResponseUnitConversion` Specifies how quantities for usage based charges will be converted. - **DivisionFactor:** `float64` The conversion factor - **RoundingBehavior:** `V1PlanListChargesResponseUnitConversionRoundingBehavior` Whether usage should be rounded down or up to the nearest whole number. If null, quantity will be rounded to 20 decimal places. - `V1PlanListChargesResponseUnitConversionRoundingBehavior` - `V1PlanListChargesResponseUnitConversionRoundingBehavior` ### Example ```go package main import ( "context" "fmt" "github.com/Metronome-Industries/metronome-go" "github.com/Metronome-Industries/metronome-go/option" ) func main() { client := metronome.NewClient( option.WithBearerToken("My Bearer Token"), ) page, err := client.V1.Plans.ListCharges(context.TODO(), metronome.V1PlanListChargesParams{ PlanID: metronome.F("d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` ## List Customers `client.V1.Plans.ListCustomers(ctx, params) (*CursorPage[V1PlanListCustomersResponse], error)` **get** `/v1/planDetails/{plan_id}/customers` Fetches a list of customers on a specific plan (by default, only currently active plans are included) ### Parameters - **params:** `V1PlanListCustomersParams` - **PlanID:** `param.Field[string]` Path param: - **Limit:** `param.Field[int64]` Query param: Max number of results that should be returned - **NextPage:** `param.Field[string]` Query param: Cursor that indicates where the next page of results should start. - **Status:** `param.Field[V1PlanListCustomersParamsStatus]` Query param: Status of customers on a given plan. Defaults to `active`. * `all` - Return current, past, and upcoming customers of the plan. * `active` - Return current customers of the plan. * `ended` - Return past customers of the plan. * `upcoming` - Return upcoming customers of the plan. Multiple statuses can be OR'd together using commas, e.g. `active,ended`. **Note:** `ended,upcoming` combination is not yet supported. - `V1PlanListCustomersParamsStatus` - `V1PlanListCustomersParamsStatus` - `V1PlanListCustomersParamsStatus` - `V1PlanListCustomersParamsStatus` ### Returns - Not supported - **CustomerDetails:** `CustomerDetail` - **PlanDetails:** `V1PlanListCustomersResponsePlanDetails` - **ID:** `string` - **CustomFields:** `map[string, string]` - **CustomerPlanID:** `string` - **Name:** `string` - **StartingOn:** `Time` The start date of the plan - **EndingBefore:** `Time` The end date of the plan ### Example ```go package main import ( "context" "fmt" "github.com/Metronome-Industries/metronome-go" "github.com/Metronome-Industries/metronome-go/option" ) func main() { client := metronome.NewClient( option.WithBearerToken("My Bearer Token"), ) page, err := client.V1.Plans.ListCustomers(context.TODO(), metronome.V1PlanListCustomersParams{ PlanID: metronome.F("d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` ## Domain Types ### Plan Detail - Not supported - **ID:** `string` - **CustomFields:** `map[string, string]` - **Name:** `string` - **CreditGrants:** `[]PlanDetailCreditGrant` - **AmountGranted:** `float64` - **AmountGrantedCreditType:** `CreditTypeData` - **AmountPaid:** `float64` - **AmountPaidCreditType:** `CreditTypeData` - **EffectiveDuration:** `float64` - **Name:** `string` - **Priority:** `string` - **SendInvoice:** `bool` - **Reason:** `string` - **RecurrenceDuration:** `float64` - **RecurrenceInterval:** `float64` - **Description:** `string` - **Minimums:** `[]PlanDetailMinimum` - **CreditType:** `CreditTypeData` - **Name:** `string` - **StartPeriod:** `float64` Used in price ramps. Indicates how many billing periods pass before the charge applies. - **Value:** `float64` - **OverageRates:** `[]PlanDetailOverageRate` - **CreditType:** `CreditTypeData` - **FiatCreditType:** `CreditTypeData` - **StartPeriod:** `float64` Used in price ramps. Indicates how many billing periods pass before the charge applies. - **ToFiatConversionFactor:** `float64`