Update a Plan

Updates a plan object in your ChartMogul account.

Examples
curl -X PATCH "https://api.chartmogul.com/v1/plans/pl_eed05d54-75b4-431b-adb2-eb6b9e543206" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json"
     -d '{ 
           "name": "Bronze Monthly Plan"
         }'
plan = ChartMogul::Plan.retrieve("pl_eed05d54-75b4-431b-adb2-eb6b9e543206")

plan.name = "Bronze Monthly Plan"

plan.update!
ChartMogul.Plan.modify(config, "pl_eed05d54-75b4-431b-adb2-eb6b9e543206", {
    name: "Bronze Monthly Plan"
})
<?php

ChartMogul\Plan::update([
    'plan_uuid' => "pl_eed05d54-75b4-431b-adb2-eb6b9e543206"
        ], [
    "name" => "Bronze Monthly Plan",
]);
?>
api.UpdatePlan(&cm.Plan{
  Name: "Bronze Monthly Plan",
}, "pl_eed05d54-75b4-431b-adb2-eb6b9e543206")
chartmogul.Plan.modify(
    config,
    uuid="pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
    data={
      "name": "Bronze Monthly Plan"
    })
Result Format
{
   "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_eed05d54-75b4-431b-adb2-eb6b9e543206",
@data_source_uuid="ds_fef05d54-47b4-431b-aed2-eb6b9e545430", 
@name="Bronze Monthly Plan", 
@interval_count=1, 
@interval_unit="month", 
@external_id="plan_0001"
>
{
   "uuid": "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
   "data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
   "name": "Bronze Monthly Plan",
   "interval_count": 1,
   "interval_unit": "month",
   "external_id": "plan_0001"
}
<?php

ChartMogul\Plan::__set_state(array(
   "uuid" => "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
   "name" => "Bronze Monthly Plan",
   "interval_count" => 1,
   "interval_unit" => "month",
   "external_id" => "plan_0001",
   "data_source_uuid" => "ds_7f38c0d0-cc2f-11e6-91c9-5b7dd3da2e7a"
));
?>
(*chartmogul.Plan)(0xc04203e5a0)({
 UUID: (string) (len=39) "pl_9599eaf6-ee09-11e6-ae39-c7c8fe81e14e",
 DataSourceUUID: (string) (len=39) "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
 ExternalID: (string) (len=9) "plan_0001",
 Name: (string) (len=11) "Bronze Monthly Plan",
 IntervalCount: (uint32) 1,
 IntervalUnit: (string) (len=5) "month"
})
<Plan{
    data_source_uuid='pl_eed05d54-75b4-431b-adb2-eb6b9e543206',
    external_id='plan_0004',
    interval_count=1,
    interval_unit='month',
    name='Bronze Monthly Plan',
    uuid='pl_eed05d54-75b4-431b-adb2-eb6b9e543206'}>

In the response, the JSON object contains 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_unit attribute) between each billing date.
  • 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_count would be 3 and interval_unit would be month.
  • external_id - The unique external identifier for this plan, as specified by you.
Language
Authentication
Basic
base64
: