post https://api.chartmogul.com/v1/plan_groups
Creates a plan_group
object in ChartMogul.
Examples
curl -X POST "https://api.chartmogul.com/v1/plan_groups" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"name": "Example Plan Group",
"plans": ["pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12", "pl_6add9607-23ce-11eb-8b6f-cfcb12b8f91f"]
}'
plan_one = ChartMogul::Plan.retrieve("pl_654ebf8c-fedf-11e8-9e92-771f765891d6")
=> #<ChartMogul::Plan:0x00007f9e1a791228
@data_source_uuid="ds_2db2f534-fd40-11e8-ba71-07db219fd509",
@external_id="bestest",
@interval_count=1,
@interval_unit="month",
@name="The bestest of plans",
@uuid="pl_654ebf8c-fedf-11e8-9e92-771f765891d6">
plan_two = ChartMogul::Plan.retrieve("pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12")
=> #<ChartMogul::Plan:0x00007f9dbe9dc228
@data_source_uuid="ds_7286b69e-d060-11e8-a96e-7330c0553016",
@external_id="1260.0-USD-1-Month",
@interval_count=1,
@interval_unit="month",
@name="Custom ($1,260 monthly)",
@uuid="pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12">
ChartMogul::PlanGroup.create!(
name: "Example Plan Group",
plans: [plan_one, plan_two]
)
ChartMogul.PlanGroup.create(config, {
"name": "Example Plan Group",
"plans": ["pl_8f25aab8-fee5-11e8-abfb-93e156343d6b", "pl_8f286bae-fee5-11e8-abfb-3fd02b4a38a8"],
}, function (err, res) {
// asynchronously called
});
<?php
ChartMogul\PlanGroup::create([
"name" => "Bronze Plan",
"plans" => [$plan_uuid_1, $plan_uuid_2],
]);
?>
api.CreatePlanGroup(&cm.PlanGroup{
Name: "name",
Plans: []*string{&planOne.UUID, &planTwo.UUID}
})
Chartmogul.PlanGroup.create(
config,
data={
"name": "Awesome Plan",
"plans": ["pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12", "pl_6add9607-23ce-11eb-8b6f-cfcb12b8f91f"],
})
Result Format
{
"name": "Example Plan Group",
"uuid": "plg_21304231-dfb4-41c0-a84c-de4783c5534c",
"plans_count": 2
}
<ChartMogul::PlanGroup:0x00007f9e1a560d78
@name="Example Plan Group",
@plans_count=2,
@uuid="plg_eefc9886-cdb9-4251-8330-e99fff1b44a6">
{
"name": "Example Plan Group",
"uuid": "plg_21304231-dfb4-41c0-a84c-de4783c5534c",
"plans_count": 2
}
<?php
ChartMogul\Plan::__set_state(array(
"uuid" => "plg_eed05d54-75b4-431b-adb2-eb6b9e543206",
"name" => "Example Plan Group",
"plans_count" => 2,
));
?>
(*chartmogul.PlanGroup)(0xc04203e5a0)({
UUID: (string) (len=39) "plg_9599eaf6-ee09-11e6-ae39-c7c8fe81e14e",
Name: (string) (len=11) "Example Plan Group",
PlansCount: (uint32) 2,
})
<PlanGroup{
plans_count=2,
name='Example Plan Group',
uuid='plg_86382dae-ee0c-11e6-ba5f-d71bf57a88d3'}>
In the response, the JSON
object contains the following data:
uuid
- The UUID of theplan group
object generated by ChartMogul.name
- Name of this plan group, as specified by you.plans_count
- The number of plans in the plan group.