get https://api.chartmogul.com/v1/plans
Returns a list of plan
objects in your ChartMogul account.
Examples
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(page: 1, per_page: 200)
ChartMogul.Plan.all(config, function (err, res) {
// asynchronously called
});
<?php
ChartMogul\Plan::all(["per_page" => 3]);
?>
api.ListPlans(&cm.ListPlansParams{Cursor: cm.Cursor{PerPage: 3}})
chartmogul.Plan.all(config, per_page=3)
Result Format
{
"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,
"total_pages": 2
}
#<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,
@total_pages=1>
{
"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,
"total_pages": 2
}
<?php
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,
"total_pages" => 2
));
?>
(*chartmogul.Plans)(0xc0420b0f60)({
Plans: ([]*chartmogul.Plan) (len=3) {
(*chartmogul.Plan)(0xc04201aae0)({
UUID: (string) (len=39) "pl_86382dae-ee0c-11e6-ba5f-d71bf57a88d3",
DataSourceUUID: (string) (len=39) "ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11",
ExternalID: (string) (len=9) "plan_0004",
Name: (string) (len=12) "Awesome Plan",
IntervalCount: (uint32) 1,
IntervalUnit: (string) (len=5) "month"
}),
(*chartmogul.Plan)(0xc04201ab40)({
UUID: (string) (len=39) "pl_8da1caec-ee0b-11e6-a4d9-dbe62a1a1694",
DataSourceUUID: (string) (len=39) "ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11",
ExternalID: (string) (len=9) "plan_0002",
Name: (string) (len=9) "Gold Plan",
IntervalCount: (uint32) 1,
IntervalUnit: (string) (len=5) "month"
}),
(*chartmogul.Plan)(0xc04201aba0)({
UUID: (string) (len=39) "pl_9599eaf6-ee09-11e6-ae39-c7c8fe81e14e",
DataSourceUUID: (string) (len=39) "ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11",
ExternalID: (string) (len=9) "plan_0001",
Name: (string) (len=11) "Bronze Plan",
IntervalCount: (uint32) 1,
IntervalUnit: (string) (len=5) "month"
})
},
TotalPages: (uint32) 1,
CurrentPage: (uint32) 1
})
Plans(plans=[
<Plan{
data_source_uuid='ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11',
external_id='plan_0004',
interval_count=1,
interval_unit='month',
name='Awesome Plan',
uuid='pl_86382dae-ee0c-11e6-ba5f-d71bf57a88d3'}>,
<Plan{
data_source_uuid='ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11',
external_id='plan_0002',
interval_count=1,
interval_unit='month',
name='Gold Plan',
uuid='pl_8da1caec-ee0b-11e6-a4d9-dbe62a1a1694'}>,
<Plan{
data_source_uuid='ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11',
external_id='plan_0001',
interval_count=1,
interval_unit='month',
name='Bronze Plan',
uuid='pl_9599eaf6-ee09-11e6-ae39-c7c8fe81e14e'}>],
current_page=1,
total_pages=1)
In the response, plans
contains an array of plan
objects with the following data:
uuid
- The UUID of theplan
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 theinterval_unit
attribute) 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, theninterval_count
would be3
andinterval_unit
would bemonth
.external_id
- The unique external identifier for this plan, as specified by you.
The other keys represent pagination attributes:
total_pages
- The total number of pages with results for this request.current_page
- The page number of this response.