List Plans
GET https://api.chartmogul.com/v1/plans
Returns a list of plan objects in your ChartMogul account.
curl -X GET "https://api.chartmogul.com/v1/plans?per_page=3&data_source_uuid=ds_fef05d54-47b4-431b-aed2-eb6b9e545430" \
-u YOUR_API_KEY:
ChartMogul::Plan.all(per_page: 3)
ChartMogul.Plan.all(config, { per_page: 3 });
ChartMogul\Plan::all(["per_page" => 3]);
api.ListPlans(&cm.ListPlansParams{Cursor: cm.Cursor{PerPage: 3}})
chartmogul.Plan.all(config, per_page=3)
{
"plans": [
{
"uuid": "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"name": "Bronze Plan",
"interval_count": 1,
"interval_unit": "month",
"external_id": "plan_0001"
},
{
"uuid": "pl_cdb35d54-75b4-431b-adb2-eb6b9e873425",
"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"name": "Silver Plan",
"interval_count": 6,
"interval_unit": "month",
"external_id": "plan_0002"
},
{
"uuid": "pl_ab225d54-7ab4-421b-cdb2-eb6b9e553462",
"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"name": "Gold Plan",
"interval_count": 1,
"interval_unit": "year",
"external_id": "plan_0003"
}
],
"current_page": 1, // deprecated
"total_pages": 2, // deprecated
"cursor": "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
"has_more": true
}
#<ChartMogul::Plans:0x00000003eb9e18
@plans=[
#<ChartMogul::Plan:0x007fb4993f25a0
@uuid="pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
@data_source_uuid="ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
@name="Bronze Plan",
@interval_count=1,
@interval_unit="month",
@external_id="plan_0001"
>,
#<ChartMogul::Plan:0x007fb4993f25a0
@uuid="pl_cdb35d54-75b4-431b-adb2-eb6b9e873425",
@data_source_uuid="ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
@name="Silver Plan",
@interval_count=6,
@interval_unit="month",
@external_id="plan_0002"
>,
#<ChartMogul::Plan:0x007fb4993f25a0
@uuid="pl_ab225d54-7ab4-421b-cdb2-eb6b9e553462",
@data_source_uuid="ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
@name="Gold Plan",
@interval_count=1,
@interval_unit="year",
@external_id="plan_0003"
>
],
@current_page=1, # deprecated with version 4.0.0
@total_pages=1>, # deprecated with version 4.0.0
@cursor="AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k"
@has_more=true
>
{
plans: [
{
uuid: "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
data_source_uuid: "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
name: "Bronze Plan",
interval_count: 1,
interval_unit: "month",
external_id: "plan_0001"
},
{
uuid: "pl_cdb35d54-75b4-431b-adb2-eb6b9e873425",
data_source_uuid: "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
name: "Silver Plan",
interval_count: 6,
interval_unit: "month",
external_id: "plan_0002"
},
{
uuid: "pl_ab225d54-7ab4-421b-cdb2-eb6b9e553462",
data_source_uuid: "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
name: "Gold Plan",
interval_count: 1,
interval_unit: "year",
external_id: "plan_0003"
}
],
current_page: 1, // deprecated
total_pages: 2, // deprecated
cursor: "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
has_more: true
}
Doctrine\Common\Collections\ArrayCollection::__set_state(array(
"elements" =>
array(
0 => ChartMogul\Plan::__set_state(array(
"uuid" => "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
"name" => "Bronze Plan",
"interval_count" => 1,
"interval_unit" => "month",
"external_id" => "plan_0001",
"data_source_uuid" => "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
)),
1 => ChartMogul\Plan::__set_state(array(
"uuid" => "pl_cdb35d54-75b4-431b-adb2-eb6b9e873425",
"name" => "Silver Plan",
"interval_count" => 6,
"interval_unit" => "month",
"external_id" => "plan_0002",
"data_source_uuid" => "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
)),
2 => ChartMogul\Plan::__set_state(array(
"uuid" => "pl_ab225d54-7ab4-421b-cdb2-eb6b9e553462",
"name" => "Gold Plan",
"interval_count" => 1,
"interval_unit" => "year",
"external_id" => "plan_0003",
"data_source_uuid" => "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
)),
),
"current_page" => 1, # deprecated with version 6.0.0
"total_pages" => 2, # deprecated with version 6.0.0
"cursor" => "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
"has_more" => true
));
(*chartmogul.Plans)(0xc0420b0f60)({
Plans: ([]*chartmogul.Plan) (len=3) {
(*chartmogul.Plan)(0xc04201aae0)({
UUID: (string) (len=39) "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
DataSourceUUID: (string) (len=39) "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
ExternalID: (string) (len=9) "plan_0001",
Name: (string) (len=11) "Bronze Plan",
IntervalCount: (uint32) 1,
IntervalUnit: (string) (len=5) "month"
}),
(*chartmogul.Plan)(0xc04201ab40)({
UUID: (string) (len=39) "pl_cdb35d54-75b4-431b-adb2-eb6b9e873425",
DataSourceUUID: (string) (len=39) "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
ExternalID: (string) (len=9) "plan_0002",
Name: (string) (len=11) "Silver Plan",
IntervalCount: (uint32) 6,
IntervalUnit: (string) (len=5) "month"
}),
(*chartmogul.Plan)(0xc04201aba0)({
UUID: (string) (len=39) "pl_ab225d54-7ab4-421b-cdb2-eb6b9e553462",
DataSourceUUID: (string) (len=39) "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
ExternalID: (string) (len=9) "plan_0003",
Name: (string) (len=9) "Gold Plan",
IntervalCount: (uint32) 1,
IntervalUnit: (string) (len=5) "year"
})
},
TotalPages: (uint32) 1, // deprecated with version v4
CurrentPage: (uint32) 1, // deprecated with version v4
Cursor: (string) (len=44) "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
HasMore: (bool) true
})
Plans(
plans=[
<Plan{
data_source_uuid="ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
external_id="plan_0001",
interval_count=1,
interval_unit="month",
name="Bronze Plan",
uuid="pl_eed05d54-75b4-431b-adb2-eb6b9e543206"
}>,
<Plan{
data_source_uuid="ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
external_id="plan_0002",
interval_count=6,
interval_unit="month",
name="Silver Plan",
uuid="pl_cdb35d54-75b4-431b-adb2-eb6b9e873425"
}>,
<Plan{
data_source_uuid="ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
external_id="plan_0003",
interval_count=1,
interval_unit="year",
name="Gold Plan",
uuid="pl_ab225d54-7ab4-421b-cdb2-eb6b9e553462"
}>
],
current_page=1, # deprecated with version 4.0.0
total_pages=1, # deprecated with version 4.0.0
cursor="AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
has_more=True
)
Query parameters
data_source_uuidstring optional- An optional filter parameter, for the ChartMogul UUID of the data source to which the desired plans belong.
external_idstring optional- An optional filter parameter, for the unique external identifier of the desired plan.
systemstring optional- An optional filter parameter, for the billing system that the plan belongs to. For example,
Stripe,RecurlyorCustom. cursorstring optional- A value that fetches the next page of Plans. To fetch next page of Plans, set
cursorto the value received in the previous page response. per_pageint32 optional default: 200- A limit on number of plans to return per page. The default and maximum value is
200.
Response
In the response, plans contains an array of plan objects with the following data:
uuid- The UUID of the plan object generated by ChartMogul.
data_source_uuid- The UUID of the data source that this subscription plan belongs to.
name- Name of this plan, as specified by you.
interval_count- The number of intervals (specified in the
interval_unitattribute) between each subscription billing. interval_unit- The frequency with which a subscription for this plan is billed. For example, if you bill your customer every 3 months for a subscription with this plan, then
interval_countwould be 3 andinterval_unitwould be month. external_id- The unique external identifier for this plan, as specified by you.
The other keys represent pagination attributes:
cursor- A value that should be used in the next API request to fetch the next page of plans. Request for the next page should be initiated only if has_more is set to true indicating that there are more plans to list.
has_more- One of true or false depending on whether there are more pages with results for this request.