List Charges
List plan charges
client.v1.plans.listCharges(PlanListChargesParamsparams, RequestOptionsoptions?): CursorPage<idstringcharge_typeunioncredit_typeCreditTypeDatacustom_fieldsRecord<string, string>namestringpricesarrayproduct_idstringproduct_namestringquantitynumberstart_periodnumbertier_reset_frequencynumberunit_conversionUnitConversionPlanListChargesResponse>
get/v1/planDetails/{plan_id}/charges
Fetches a list of charges of a specific plan.
Parameters
paramsplan_idstringlimitnumbernext_pagestringPlanListChargesParams
Returns
PlanListChargesResponse
import Metronome from '@metronome/sdk';
const client = new Metronome({
bearerToken: 'My Bearer Token',
});
// Automatically fetches more pages as needed.
for await (const planListChargesResponse of client.v1.plans.listCharges({
plan_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
})) {
console.log(planListChargesResponse.id);
}
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"
}