NAV Navbar
cURL .NET Java Go PHP Python Ruby

Plans

A plan describes a fixed amount that is billed to customers over a recurring interval. Used with subscriptions.

Plan Object

Attributes

{
    "amount": 49,
    "catalog_item": "software-subscription",
    "created_at": 1477418268,
    "currency": "usd",
    "id": "starter",
    "interval": "month",
    "interval_count": 1,
    "metadata": [],
    "name": "Starter",
    "object": "plan",
    "pricing_mode": "per_unit",
    "quantity_type": "constant",
    "tiers": null,
    "updated_at": 1477418268
}
Parameter Type Description
id string The plan's unique ID
object string Object type, plan
catalog_item string Item ID the plan belongs to
name string Plan name
currency string 3-letter ISO code
amount number Plan amount. Not applicable when pricing mode is custom.
pricing_mode string per_unit, volume, tiered or custom
quantity_type string constant or usage
interval string One of day, week, month, year. The frequency with which a subscription should be billed.
interval_count number The number of intervals between each subscription billing. Defaults to 1.
tiers array Example: [{“max_qty”:50,”unit_cost”:100},{“min_qty”:51,”max_qty”:100,”unit_cost”:80},{“min_qty”:101,”unit_cost”:70}]
created_at timestamp Timestamp when created
updated_at timestamp Timestamp when updated
metadata object A hash of key/value pairs that can store additional information about this object.

Create a plan

curl "https://api.invoiced.com/plans" \
  -u {API_KEY}: \
  -d id="starter" \
  -d name="Starter" \
  -d catalog_item="software-subscription" \
  -d amount=49 \
  -d interval="month" \
  -d interval_count=1 \
  -d pricing_mode="per_unit"
invoiced.Plan.create(
  :id => "starter",
  :name => "Starter",
  :catalog_item => "software-subscription",
  :amount => 49,
  :interval => "month",
  :interval_count => 1,
  :pricing_mode => "per_unit"
)
<?php

$invoiced->Plan->create([
  'id' => "starter",
  'name' => "Starter",
  'catalog_item' => "software-subscription",
  'amount' => 49,
  'interval' => "month",
  'interval_count' => 1,
  'pricing_mode' => "per_unit"
]);
client.Plan.create(
  id="starter",
  name="Starter",
  catalog_item="software-subscription",
  amount=49,
  interval="month",
  interval_count=1,
  pricing_mode="per_unit"
)
Plan plan = invoiced.newPlan();
plan.id = "starter";
plan.name = "Starter";
plan.item = "software-subscription";
plan.amount = 49;
plan.interval = "month";
plan.intervalCount = 1;
plan.pricingMode = "per_unit";
plan.create();
var plan = invoiced.NewPlan();
plan.Id = "starter";
plan.Name = "Starter";
plan.Item = "software-subscription";
plan.Amount = 49;
plan.Interval = "month";
plan.IntervalCount = 1;
plan.PricingMode = "per_unit";
plan.Create();
plan, err := client.Plan.Create(&invoiced.PlanRequest{
  Id: invoiced.String("starter"),
  Name: invoiced.String("Starter"),
  Item: invoiced.String("software-subscription"),
  Amount: invoiced.Float64(49),
  Interval: invoiced.String("month"),
  IntervalCount: invoiced.Int64(1),
  PricingMode: invoiced.String("per_unit"),
})

The above command returns JSON structured like this:

{
    "amount": 49,
    "catalog_item": "software-subscription",
    "created_at": 1477418268,
    "currency": "usd",
    "id": "starter",
    "interval": "month",
    "interval_count": 1,
    "metadata": [],
    "name": "Starter",
    "object": "plan",
    "pricing_mode": "per_unit",
    "quantity_type": "constant",
    "tiers": null,
    "updated_at": 1477418268
}

Create a new plan with this endpoint.

HTTP Request

POST /plans

Attributes

Parameter Type Description
id string The plan's unique ID. Auto-generated by default.
catalog_item string Item ID the plan belongs to
name string Plan name
currency string 3-letter ISO code
amount number Plan amount
pricing_mode string per_unit, volume or tiered
quantity_type string constant or usage
interval string One of day, week, month, year. The frequency with which a subscription should be billed.
interval_count number The number of intervals between each subscription billing. Defaults to 1.
tiers array Example: [{“max_qty”:50,”unit_cost”:100},{“min_qty”:51,”max_qty”:100,”unit_cost”:80},{“min_qty”:101,”unit_cost”:70}]
metadata object A hash of key/value pairs that can store additional information about this object.

Retrieve a plan

curl "https://api.invoiced.com/plans/:id" \
  -u {API_KEY}:
plan = invoiced.Plan.retrieve("{PLAN_ID}")
<?php

$plan = $invoiced->Plan->retrieve("{PLAN_ID}");
plan = client.Plan.retrieve("{PLAN_ID}")
Plan plan = invoiced.newPlan().retrieve({PLAN_ID});
var plan = invoiced.NewPlan().Retrieve({PLAN_ID});
plan, err := client.Plan.Retrieve({PLAN_ID})

The above command returns JSON structured like this:

{
    "amount": 49,
    "catalog_item": "software-subscription",
    "created_at": 1477418268,
    "currency": "usd",
    "id": "starter",
    "interval": "month",
    "interval_count": 1,
    "metadata": [],
    "name": "Starter",
    "object": "plan",
    "pricing_mode": "per_unit",
    "quantity_type": "constant",
    "tiers": null,
    "updated_at": 1477418268
}

This endpoint retrieves a specific plan.

HTTP Request

GET /plans/:id

Update a plan

curl "https://api.invoiced.com/plans/:id" \
  -u {API_KEY}: \
  -X PATCH \
  -d name="Standard"
plan.name = "Standard"
plan.save
<?php

$plan->name = "Standard";
$plan->save();
plan.name = "Standard"
plan.save()
plan.name = "Standard";
plan.save();
plan.Name = "Standard";
plan.SaveAll();
err := client.Plan.Update(&invoiced.PlantRequest{
  Name: invoiced.String("Standard"),
})

The above command returns JSON structured like this:

{
    "amount": 49,
    "catalog_item": "software-subscription",
    "created_at": 1477418268,
    "currency": "usd",
    "id": "starter",
    "interval": "month",
    "interval_count": 1,
    "metadata": [],
    "name": "Standard",
    "object": "plan",
    "pricing_mode": "per_unit",
    "quantity_type": "constant",
    "tiers": null,
    "updated_at": 1477418268
}

Use this endpoint to update a plan.

The properties that can be updated via this endpoint are limited. For other updates, it is necessary to delete and recreate the plan.

HTTP Request

PATCH /plans/:id

Attributes

Parameter Type Description
name string Plan name
metadata object A hash of key/value pairs that can store additional information about this object.

Delete a plan

curl "https://api.invoiced.com/plans/:id" \
  -u {API_KEY}: \
  -X DELETE
plan.delete
<?php

$plan->delete();
plan.delete()
plan.delete();
plan.Delete();
err := client.Plan.Delete({INVOICED_ID})

The above command returns 204 No Content

This endpoint deletes a specific plan.

HTTP Request

DELETE /plans/:id

List all plans

curl "https://api.invoiced.com/plans" \
  -u {API_KEY}:
items, metadata = invoiced.Plan.list(:per_page => 3)
<?php

list($plans, $metadata) = $invoiced->Plan->all(['per_page' => 3]);
plans, metadata = client.Plan.list(per_page=3)
EntityList<Plan> plans = conn.newPlan().listAll();
var plans = invoiced.NewPlan().ListAll();
plans, err := client.Plan.ListAll(nil, nil)

The above command returns JSON structured like this:

[
  {
     "amount": 49,
     "catalog_item": "software-subscription",
     "created_at": 1477418268,
     "currency": "usd",
     "id": "starter",
     "interval": "month",
     "interval_count": 1,
     "metadata": [],
     "name": "Starter",
     "object": "plan",
     "pricing_mode": "per_unit",
     "quantity_type": "constant",
     "tiers": null,
     "updated_at": 1477418268
 }
]

This endpoint retrieves all plans.

HTTP Request

GET /plans

Query Parameters

Parameter Description
sort string Column to sort by, i.e. name asc
filter object Filter object
updated_after timestamp Only gets records updated after the given timestamp