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"
);
// For chartmogul-php < 2.0.0
ChartMogul\Metrics\Subscriptions::all([
"customer_uuid" => "cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b"
]);
// For chartmogul-php >= 2.0.0
ChartMogul\Metrics\Customers\Subscriptions::all([
"customer_uuid" => "cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b"
]);
// For chartmogul-go < 2.0.0
api.MetricsListSubscriptions(&cm.Cursor{PerPage: 1},
"cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b")
// For chartmogul-go >= 2.0.0
api.MetricsListCustomerSubscriptions(&cm.Cursor{PerPage: 1},
"cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b")
# For chartmogul-python < 2.0.0
chartmogul.Subscription.all(
config, uuid="cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b", per_page=1
)
# For chartmogul-python >= 2.0.0
chartmogul.CustomerSubscription.all(
config, uuid="cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b", per_page=1
)
Result Format
{
"entries": [
{
"id": 9306830,
"external_id": "sub_0001",
"plan": "Gold Monthly",
"quantity": 1,
"uuid": "d1c0c885-add0-48db-8fa9-0bdf5017d6b0",
"mrr": 70800,
"arr": 849600,
"status": "active",
"billing-cycle": "month",
"billing-cycle-count": 1,
"start-date": "2023-06-20T08:26:49-05:00",
"end-date": "2023-09-20T09:26:49-05:00",
"currency": "USD",
"currency-sign": "$"
}
],
"per_page": 200, // deprecated
"page": 1, // deprecated
"cursor": "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
"has_more": true
}
#<ChartMogul::Metrics::Subscriptions:0x007faf058c8f28
@entries=[
#<ChartMogul::Metrics::Subscription:0x007faf058c8d98
@id=9306830,
@external_id="sub_0001",
@plan="Gold Monthly",
@quantity=1,
@mrr=70800,
@arr=849600,
@status="active",
@billing_cycle="month",
@billing_cycle_count=1,
@start_date=2023-06-20 08:26:49 -0500,
@end_date=2023-09-20 09:26:49 -05:00,
@currency="USD",
@currency_sign="$"
>
],
@per_page=200, # deprecated with version 4.0.0
@page=1, # deprecated with version 4.0.0
@cursor="AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
@has_more=true
>
{
entries: [
{
id: 9306830,
external_id: "sub_0001",
plan: "Gold Monthly",
quantity: 1,
uuid: "d1c0c885-add0-48db-8fa9-0bdf5017d6b0",
mrr: 70800,
arr: 849600,
status: "active",
"billing-cycle": "month",
"billing-cycle-count": 1,
"start-date": "2023-06-20T08:26:49-05:00",
"end-date": "2023-09-20T09:26:49-05:00",
currency: "USD",
"currency-sign": "$"
}
],
per_page: 200, // deprecated
page: 1, // deprecated
cursor: "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
has_more: true
}
// For chartmogul-php < 2.0.0
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" => "Gold Monthly",
"quantity" => 1,
"mrr" => 70800,
"arr" => 849600,
"status" => "active",
"billing-cycle" => "month",
"billing-cycle-count" => 1,
"start-date" => "2023-06-20T08:26:49-05:00",
"end-date" => "2023-09-20T09:26:49-05:00",
"currency" => "USD",
"currency-sign" => "$"
))
),
)),
"per_page" => 200, # deprecated with version 6.0.0
"page" => 1, # deprecated with version 6.0.0
"cursor" => "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
"has_more" => true
))
// For chartmogul-go < 2.0.0
(*chartmogul.MetricsSubscriptions)(0xc042042f30)({
Entries: ([]*chartmogul.MetricsSubscription) (len=1) {
(*chartmogul.MetricsSubscription)(0xc04200f0e0)({
ID: (uint64) 9306830,
ExternalID: (string) (len=8) "sub_0001",
Plan: (string) (len=12) "Gold Monthly",
Quantity: (uint32) 1,
MRR: (float64) 70800,
ARR: (float64) 849600,
Status: (string) (len=6) "active",
BillingCycle: (string) (len=5) "month",
BillingCycleCount: (uint32) 1,
StartDate: (string) (len=25) "2023-06-20T08:26:49-05:00",
EndDate: (string) (len=25) "2023-09-20T09:26:49-05:00",
Currency: (string) (len=3) "USD",
CurrencySign: (string) (len=1) "$"
})
},
PerPage: (uint32) 1, // deprecated with version v4
Page: (uint32) 1, // deprecated with version v4
Cursor: (string) (len=44) "AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
HasMore: (bool) true
})
Subscriptions(
entries=[
<Subscription{
arr=849600.0,
external_id="sub_0001",
billing_cycle="month",
billing_cycle_count=1.0,
currency="USD",
currency_sign="$",
end_date=datetime.datetime(2023, 9, 20, 9, 26),
id=9306830,
mrr=70800.0,
plan="Gold Monthly",
quantity=1,
start_date=datetime.datetime(2023, 6, 20, 8, 26),
status="active"
}>
],
per_page=1, # deprecated with version 4.0.0
page=1, # deprecated with version 4.0.0
cursor="AjMx90kC0yMVQwNNwoYToyNC4wMDAwMDAwMDBgks68k",
has_more=True
)
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:
cursor
- A value that should be used in the next API request to fetch the next page of customer subscriptions. Request for next page should be initiated only ifhas_more
is set totrue
indicating that there are more customer subscriptions to list.has_more
- One oftrue
orfalse
depending on whether there are more pages with results for this request.per_page
-DEPRECATED
The number of results in this response.page
-DEPRECATED
The page number of this response.