-
Notifications
You must be signed in to change notification settings - Fork 85
Plans
Emanuel Danci edited this page Dec 22, 2015
·
34 revisions
For resource definition check out Resources page.
- Retrieve all plans
- Create a plan
- Retrieve a specific plan
- Update a plan
- Disable a plan
- List all metered features
- List the metered features of a plan
- Create a metered feature
By default this will list every existing Plan.
GET /plans/
Filters, such as enabled and private, can be used for better results. Available filters: name, currency, enabled, private, interval, product_code and provider.
GET /plans?enabled=True&private=False
POST /plans
{
'name': 'Hydrogen',
'interval': 'month',
'interval_count': 1,
'amount': 150,
'currency': 'USD',
'trial_period_days': 15,
'metered_features': [
{
'name': 'Page Views',
'unit': '100k',
'price_per_unit': 0.01,
'included_units': 2.5,
'product_code': 'existing_pc_2'
},
{
'name': 'VIP Support',
'price_per_unit': 49.99,
'included_units': 1,
'product_code': 'non-existing_pc'
}
],
'due_days': 10,
'generate_after': 86400,
'product_code': 'hyd_3g432556g',
'enabled': true,
'private': false,
'provider': 'www.example.com/providers/2/'
}
GET /plans/:id
Only name, generate_after and due_days are editable through API.
PATCH /plans/:id
Plans cannot be actually deleted through API but only through the admin interface. They can be only disabled by API and this is what the DELETE verb should do.
DELETE /plans/:id
GET /metered-features
GET /plans/:id/metered-features
POST /metered-features/
{
"name": "Random Metered Feature",
"unit": "pounds",
"price_per_unit": "100",
"included_units": "2",
"product_code": "Code"
}