Skip to content
  • Auto
  • Light
  • Dark
Talk to an expert

List Charges

List plan charges
client.V1.Plans.ListCharges(ctx, params) (*CursorPage[IDstringChargeTypeV1PlanListChargesResponseChargeTypeCreditTypeCreditTypeDataCustomFieldsmapNamestringPricesarrayProductIDstringProductNamestringQuantityfloat64StartPeriodfloat64TierResetFrequencyfloat64UnitConversionV1PlanListChargesResponseUnitConversionV1PlanListChargesResponse], error)
get/v1/planDetails/{plan_id}/charges

Fetches a list of charges of a specific plan.

Parameters
paramsPlanIDfieldLimitfieldNextPagefieldV1PlanListChargesParams
Hide ParametersShow Parameters
PlanIDfield
param.Field[string]

Path param:

formatuuid
Limitfield
optional
param.Field[int64]

Query param: Max number of results that should be returned

minimum1
maximum100
NextPagefield
optional
param.Field[string]

Query param: Cursor that indicates where the next page of results should start.

Returns
V1PlanListChargesResponsestruct
Hide ParametersShow Parameters
IDstring
formatuuid
ChargeTypeV1PlanListChargesResponseChargeTypeUsageV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeFixedV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeCompositeV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeMinimumV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeSeatV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeType
Hide ParametersShow Parameters
V1PlanListChargesResponseChargeTypeUsageconst
V1PlanListChargesResponseChargeTypeUsageV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeFixedV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeCompositeV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeMinimumV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeSeatV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeType
"usage"
V1PlanListChargesResponseChargeTypeFixedconst
V1PlanListChargesResponseChargeTypeUsageV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeFixedV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeCompositeV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeMinimumV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeSeatV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeType
"fixed"
V1PlanListChargesResponseChargeTypeCompositeconst
V1PlanListChargesResponseChargeTypeUsageV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeFixedV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeCompositeV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeMinimumV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeSeatV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeType
"composite"
V1PlanListChargesResponseChargeTypeMinimumconst
V1PlanListChargesResponseChargeTypeUsageV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeFixedV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeCompositeV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeMinimumV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeSeatV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeType
"minimum"
V1PlanListChargesResponseChargeTypeSeatconst
V1PlanListChargesResponseChargeTypeUsageV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeFixedV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeCompositeV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeMinimumV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeTypeSeatV1PlanListChargesResponseChargeTypeV1PlanListChargesResponseChargeType
"seat"
CreditTypeIDstringNamestringCreditTypeData
CustomFieldsmap
map[string, string]
Namestring
Hide ParametersShow Parameters
Tierfloat64

Used in pricing tiers. Indicates at what metric value the price applies.

Valuefloat64
CollectionIntervalfloat64
optional
CollectionSchedulestring
optional
Quantityfloat64
optional
ProductIDstring
ProductNamestring
Quantityfloat64
optional
StartPeriodfloat64
optional

Used in price ramps. Indicates how many billing periods pass before the charge applies.

TierResetFrequencyfloat64
optional

Used in pricing tiers. Indicates how often the tier resets. Default is 1 - the tier count resets every billing period.

Specifies how quantities for usage based charges will be converted.

Hide ParametersShow Parameters
DivisionFactorfloat64

The conversion factor

RoundingBehaviorV1PlanListChargesResponseUnitConversionRoundingBehaviorFloorV1PlanListChargesResponseUnitConversionRoundingBehaviorV1PlanListChargesResponseUnitConversionRoundingBehaviorCeilingV1PlanListChargesResponseUnitConversionRoundingBehaviorV1PlanListChargesResponseUnitConversionRoundingBehavior
optional

Whether usage should be rounded down or up to the nearest whole number. If null, quantity will be rounded to 20 decimal places.

Hide ParametersShow Parameters
V1PlanListChargesResponseUnitConversionRoundingBehaviorFloorconst
V1PlanListChargesResponseUnitConversionRoundingBehaviorFloorV1PlanListChargesResponseUnitConversionRoundingBehaviorV1PlanListChargesResponseUnitConversionRoundingBehaviorCeilingV1PlanListChargesResponseUnitConversionRoundingBehaviorV1PlanListChargesResponseUnitConversionRoundingBehavior
"floor"
V1PlanListChargesResponseUnitConversionRoundingBehaviorCeilingconst
V1PlanListChargesResponseUnitConversionRoundingBehaviorFloorV1PlanListChargesResponseUnitConversionRoundingBehaviorV1PlanListChargesResponseUnitConversionRoundingBehaviorCeilingV1PlanListChargesResponseUnitConversionRoundingBehaviorV1PlanListChargesResponseUnitConversionRoundingBehavior
"ceiling"
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)
}
200 Example
{
  "data": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "charge_type": "usage",
      "credit_type": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "name": "name"
      },
      "custom_fields": {
        "foo": "string"
      },
      "name": "name",
      "prices": [
        {
          "tier": 0,
          "value": 0,
          "collection_interval": 0,
          "collection_schedule": "collection_schedule",
          "quantity": 0
        }
      ],
      "product_id": "product_id",
      "product_name": "product_name",
      "quantity": 0,
      "start_period": 0,
      "tier_reset_frequency": 0,
      "unit_conversion": {
        "division_factor": 0,
        "rounding_behavior": "floor"
      }
    }
  ],
  "next_page": "next_page"
}