get https://api.chartmogul.com/v1/customers//subscriptions
Returns a list of subscriptions for a given customer.
Examples
curl -X GET "https://api.chartmogul.com/v1/customers/cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b/subscriptions" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json"
# For chartmogul-ruby < 2.0.0
ChartMogul::Metrics::Subscription.all('cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b')
# For chartmogul-ruby >= 2.0.0
ChartMogul::Metrics::Customers::Subscription.all('cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b')
ChartMogul.Metrics.Customer.subscriptions(config, "cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b", function (err, res) {
// asynchronously called
});
// For chartmogul-php < 2.0.0
<?php
ChartMogul\Metrics\Subscriptions::all(
["customer_uuid" => "cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b"]
);
?>
// For chartmogul-php >= 2.0.0
<?php
ChartMogul\Metrics\Customers\Subscriptions::all([
"customer_uuid" => $cus->uuid
]);
?>
// For chartmogul-go < 2.0.0
api.MetricsListSubscriptions(&cm.Cursor{PerPage: 1},
"cus_922c2672-ee04-11e6-bea8-7fac984477db")
// For chartmogul-go >= 2.0.0
api.MetricsListCustomerSubscriptions(&cm.Cursor{PerPage: 1},
"cus_922c2672-ee04-11e6-bea8-7fac984477db")
# For chartmogul-python < 2.0.0
chartmogul.Subscription.all(
config,
uuid="cus_922c2672-ee04-11e6-bea8-7fac984477db",
per_page=1)
# For chartmogul-python >= 2.0.0
chartmogul.CustomerSubscription.all(
config,
uuid="cus_922c2672-ee04-11e6-bea8-7fac984477db",
per_page=1)
Result Format
{
"entries": [
{
"id": 9306830,
"external_id": "sub_0001",
"plan": "PRO Plan (10,000 active cust.) monthly",
"quantity": 1,
"uuid":"d1c0c885-add0-48db-8fa9-0bdf5017d6b0",
"mrr": 70800,
"arr": 849600,
"status": "active",
"billing-cycle": "month",
"billing-cycle-count": 1,
"start-date": "2015-12-20T08:26:49-05:00",
"end-date": "2016-03-20T09:26:49-05:00",
"currency": "USD",
"currency-sign": "$"
}
],
"has_more": false,
"per_page": 200,
"page": 1
}
#<ChartMogul::Metrics::Subscriptions:0x007faf058c8f28
@entries=[
#<ChartMogul::Metrics::Subscription:0x007faf058c8d98
@id=9306830,
@external_id="sub_0001",
@plan="PRO Plan (10,000 active cust.) monthly",
@quantity=1,
@mrr=70800,
@arr=849600,
@status="active",
@billing_cycle="month",
@billing_cycle_count=1,
@start_date=2015-12-20 08:26:49 -0500,
@end_date=2016-03-20 09:26:49 -05:00,
@currency="USD",
@currency_sign="$"
>
],
@has_more=false,
@per_page=200,
@page=1
>
{
"entries": [
{
"id": 9306830,
"external_id": "sub_0001",
"plan": "PRO Plan (10,000 active cust.) monthly",
"quantity": 1,
"mrr": 70800,
"arr": 849600,
"status": "active",
"billing-cycle": "month",
"billing-cycle-count": 1,
"start-date": "2015-12-20T08:26:49-05:00",
"end-date": "2016-03-20T09:26:49-05:00",
"currency": "USD",
"currency-sign": "$"
}
],
"has_more": false,
"per_page": 200,
"page": 1
}
// For chartmogul-php < 2.0.0
<?php
ChartMogul\Metrics\Subscriptions::__set_state(array(
"entries" =>
Doctrine\Common\Collections\ArrayCollection::__set_state(array(
"elements" =>
array (
ChartMogul\Metrics\Subscription::__set_state(array(
"id" => 9306830,
"external_id" => "sub_0001",
"plan" => "PRO Plan (10,000 active cust.) monthly",
"quantity" => 1,
"mrr" => 70800,
"arr" => 849600,
"status" => "active",
"billing-cycle" => "month",
"billing-cycle-count" => 1,
"start-date" => "2015-12-20T08:26:49-05:00",
"end-date" => "2016-03-20T09:26:49-05:00",
"currency" => "USD",
"currency-sign" => "$"
))
),
)),
"has_more" => false,
"per_page" => 200,
"page" => 1,
))
?>
// For chartmogul-go < 2.0.0
(*chartmogul.MetricsSubscriptions)(0xc042042f30)({
Entries: ([]*chartmogul.MetricsSubscription) (len=1) {
(*chartmogul.MetricsSubscription)(0xc04200f0e0)({
ID: (uint64) 4936087,
ExternalID: (string) (len=8) "sub_0001",
Plan: (string) (len=9) "Gold Plan",
Quantity: (uint32) 1,
MRR: (float64) 4100,
ARR: (float64) 49200,
Status: (string) (len=6) "active",
BillingCycle: (string) (len=5) "month",
BillingCycleCount: (uint32) 1,
StartDate: (string) (len=25) "2015-11-01T00:00:00+00:00",
EndDate: (string) (len=25) "2015-12-01T00:00:00+00:00",
Currency: (string) (len=3) "USD",
CurrencySign: (string) (len=1) "$"
})
},
HasMore: (bool) false,
PerPage: (uint32) 1,
Page: (uint32) 1
})
Subscriptions(entries=[
<Subscription{
arr=49200.0,
external_id="sub_0001",
billing_cycle='month',
billing_cycle_count=1.0,
currency='USD',
currency_sign='$',
end_date=datetime.datetime(2015, 12, 1, 0, 0),
id=4936087,
mrr=4100.0,
plan='Gold Plan',
quantity=1,
start_date=datetime.datetime(2015, 11, 1, 0, 0),
status='active'}>],
has_more=False,
per_page=1,
page=1)
In the response, entries
contains an object for each subscription, with the following data:
id
- ChartMogul's identifier for the subscription.external_id
- The unique external identifier for this subscription. This is usually the subscription identifier from your billing system.plan
- the billing plan that the customer has subscribed to with this subscription.quantity
- the quantity of plans purchased by the customer.uuid
- The UUID of the customer subscription object generated by ChartMogul.mrr
- the current Monthly Recurring Revenue contributed by this subscription.arr
- the current Annual Run Rate of this subscription. This is calculated as the MRR * 12.status
- the current status of this subscription. One ofinactive
oractive
billing-cycle
- the billing cycle period. One ofday
,month
, oryear
.billing-cycle-count
- the integer number representing frequency of billing cycle.start-date
- the timestamp for when this subscription started.end-date
- the timestamp for when this subscription is due to run out based on payments made so far.currency
- the primary currency in which the MRR/ARR is reported.currency-sign
- text representation to display the currency. E.g.$
, or€
.
The other keys represent pagination attributes:
has_more
- One oftrue
orfalse
depending on whether there are more pages with results for this request.per_page
- The number of results in this response.page
- The page number of this response.