# Plans ## List `v1.plans.list(**kwargs) -> CursorPage` **get** `/v1/plans` List all available plans. ### Parameters - **limit:** `Integer` Max number of results that should be returned - **next\_page:** `String` Cursor that indicates where the next page of results should start. ### Returns - `class PlanListResponse` - **id:** `String` - **description:** `String` - **name:** `String` - **custom\_fields:** `Hash[Symbol, String]` ### Example ```ruby require "metronome_sdk" metronome = MetronomeSDK::Client.new(bearer_token: "My Bearer Token") page = metronome.v1.plans.list puts(page) ``` ## Get Details `v1.plans.get_details(**kwargs) -> PlanGetDetailsResponse` **get** `/v1/planDetails/{plan_id}` Fetch high level details of a specific plan. ### Parameters - **plan\_id:** `String` ### Returns - `class PlanGetDetailsResponse` - **data:** `PlanDetail` ### Example ```ruby require "metronome_sdk" metronome = MetronomeSDK::Client.new(bearer_token: "My Bearer Token") response = metronome.v1.plans.get_details(plan_id: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc") puts(response) ``` ## List Charges `v1.plans.list_charges(**kwargs) -> CursorPage` **get** `/v1/planDetails/{plan_id}/charges` Fetches a list of charges of a specific plan. ### Parameters - **plan\_id:** `String` - **limit:** `Integer` Max number of results that should be returned - **next\_page:** `String` Cursor that indicates where the next page of results should start. ### Returns - `class PlanListChargesResponse` - **id:** `String` - **charge\_type:** `:usage | :fixed | :composite | 2 more` - `:usage` - `:fixed` - `:composite` - `:minimum` - `:seat` - **credit\_type:** `CreditTypeData` - **custom\_fields:** `Hash[Symbol, String]` - **name:** `String` - **prices:** `Array[{ tier, value, collection_interval, 2 more}]` - **tier:** `Float` Used in pricing tiers. Indicates at what metric value the price applies. - **value:** `Float` - **collection\_interval:** `Float` - **collection\_schedule:** `String` - **quantity:** `Float` - **product\_id:** `String` - **product\_name:** `String` - **quantity:** `Float` - **start\_period:** `Float` Used in price ramps. Indicates how many billing periods pass before the charge applies. - **tier\_reset\_frequency:** `Float` Used in pricing tiers. Indicates how often the tier resets. Default is 1 - the tier count resets every billing period. - **unit\_conversion:** `{ division_factor, rounding_behavior}` Specifies how quantities for usage based charges will be converted. - **division\_factor:** `Float` The conversion factor - **rounding\_behavior:** `:floor | :ceiling` Whether usage should be rounded down or up to the nearest whole number. If null, quantity will be rounded to 20 decimal places. - `:floor` - `:ceiling` ### Example ```ruby require "metronome_sdk" metronome = MetronomeSDK::Client.new(bearer_token: "My Bearer Token") page = metronome.v1.plans.list_charges(plan_id: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc") puts(page) ``` ## List Customers `v1.plans.list_customers(**kwargs) -> CursorPage` **get** `/v1/planDetails/{plan_id}/customers` Fetches a list of customers on a specific plan (by default, only currently active plans are included) ### Parameters - **plan\_id:** `String` - **limit:** `Integer` Max number of results that should be returned - **next\_page:** `String` Cursor that indicates where the next page of results should start. - **status:** `:all | :active | :ended | :upcoming` 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. - `:all` - `:active` - `:ended` - `:upcoming` ### Returns - `class PlanListCustomersResponse` - **customer\_details:** `CustomerDetail` - **plan\_details:** `{ id, custom_fields, customer_plan_id, 3 more}` - **id:** `String` - **custom\_fields:** `Hash[Symbol, String]` - **customer\_plan\_id:** `String` - **name:** `String` - **starting\_on:** `Time` The start date of the plan - **ending\_before:** `Time` The end date of the plan ### Example ```ruby require "metronome_sdk" metronome = MetronomeSDK::Client.new(bearer_token: "My Bearer Token") page = metronome.v1.plans.list_customers(plan_id: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc") puts(page) ``` ## Domain Types ### Plan Detail - `class PlanDetail` - **id:** `String` - **custom\_fields:** `Hash[Symbol, String]` - **name:** `String` - **credit\_grants:** `Array[{ amount_granted, amount_granted_credit_type, amount_paid, 8 more}]` - **amount\_granted:** `Float` - **amount\_granted\_credit\_type:** `CreditTypeData` - **amount\_paid:** `Float` - **amount\_paid\_credit\_type:** `CreditTypeData` - **effective\_duration:** `Float` - **name:** `String` - **priority:** `String` - **send\_invoice:** `bool` - **reason:** `String` - **recurrence\_duration:** `Float` - **recurrence\_interval:** `Float` - **description:** `String` - **minimums:** `Array[{ credit_type, name, start_period, value}]` - **credit\_type:** `CreditTypeData` - **name:** `String` - **start\_period:** `Float` Used in price ramps. Indicates how many billing periods pass before the charge applies. - **value:** `Float` - **overage\_rates:** `Array[{ credit_type, fiat_credit_type, start_period, to_fiat_conversion_factor}]` - **credit\_type:** `CreditTypeData` - **fiat\_credit\_type:** `CreditTypeData` - **start\_period:** `Float` Used in price ramps. Indicates how many billing periods pass before the charge applies. - **to\_fiat\_conversion\_factor:** `Float`