get https://api.chartmogul.com/v1/import/customers//subscriptions
Returns a list of subscription
objects for a given customer. Subscriptions are auto-generated from invoice
objects created using the Import API.
Examples
curl -X GET "https://api.chartmogul.com/v1/import/customers/cus_f466e33d-ff2b-4a11-8f85-417eb02157a7/subscriptions" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json"
ChartMogul::Subscription.all('cus_f466e33d-ff2b-4a11-8f85-417eb02157a7', page: 1, per_page: 200)
ChartMogul.Subscription.all(config, "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7", function(err, res) {
// asynchronously called
});
<?php
$subscriptions = ChartMogul\Subscription::all([
"customer_uuid" => "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7"
]);
?>
api.ListSubscriptions(&cm.Cursor{PerPage: 2},
"cus_c0dc8d74-edfd-11e6-a357-832dddba822f")
chartmogul.Subscription.list_imported(
config,
uuid="cus_c0dc8d74-edfd-11e6-a357-832dddba822f",
per_page=2)
Result Format
{
"customer_uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
"subscriptions":[
{
"uuid": "sub_e6bc5407-e258-4de0-bb43-61faaf062035",
"external_id": "sub_0001",
"subscription_set_external_id": "set_0001",
"plan_uuid": "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"cancellation_dates":[]
}
],
"current_page": 1,
"total_pages": 1
}
#<ChartMogul::Subscriptions:0x00000003d7c870
@customer_uuid="cus_510b1395-4fe8-4d35-ae23-0e61f9a51e33",
@subscriptions=
[
#<ChartMogul::Subscription:0x007fb4991dae98
@uuid="sub_01e1b5d0-f7dd-441e-870e-62d6b7233a76",
@external_id="sub_0001",
@subscription_set_external_id="set_0001",
@plan_uuid="pl_f364391a-c08b-4586-88db-d42ca5608360",
@data_source_uuid="ds_d138c0bd-6de1-4cf5-9a16-6f0d3bc540d7",
@cancellation_dates=[]
>
],
@current_page=1,
@total_pages=1>
{
"customer_uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
"subscriptions":[
{
"uuid": "sub_e6bc5407-e258-4de0-bb43-61faaf062035",
"external_id": "sub_0001",
"subscription_set_external_id": "set_0001",
"plan_uuid": "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"cancellation_dates":[]
}
],
"current_page": 1,
"total_pages": 1
}
<?php
Doctrine\Common\Collections\ArrayCollection::__set_state(array(
"elements" =>
array (
0 =>
ChartMogul\Subscription::__set_state(array(
"uuid" => "sub_e6bc5407-e258-4de0-bb43-61faaf062035",
"external_id" => "sub_0001",
"subscription_set_external_id" => "set_001",
"cancellation_dates" =>
array (
),
"plan_uuid" => "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
"data_source_uuid" => "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
))),
"current_page" => 1,
"total_pages" => 1,
"customer_uuid" => "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
));
?>
(*chartmogul.Subscriptions)(0xc042088b40)({
Subscriptions: ([]chartmogul.Subscription) (len=2) {
(chartmogul.Subscription) {
UUID: (string) (len=40) "sub_b8ba9b19-0d7d-401c-ad99-496104b435f1",
ExternalID: (string) (len=8) "sub_0001",
SubscriptionSetExternalID: (string) (len=8) "set_0001",
PlanUUID: (string) (len=39) "pl_8da1caec-ee0b-11e6-a4d9-dbe62a1a1694",
CustomerUUID: (string) "",
DataSourceUUID: (string) (len=39) "ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11",
CancellationDates: ([]string) {
}
},
(chartmogul.Subscription) {
UUID: (string) (len=40) "sub_00fbccd1-084d-4eec-9805-685ddafcd399",
ExternalID: (string) (len=8) "sub_0002",
PlanUUID: (string) (len=39) "pl_8da1caec-ee0b-11e6-a4d9-dbe62a1a1694",
CustomerUUID: (string) "",
DataSourceUUID: (string) (len=39) "ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11",
CancellationDates: ([]string) {
}
}
},
CustomerUUID: (string) (len=40) "cus_c0dc8d74-edfd-11e6-a357-832dddba822f",
TotalPages: (uint32) 2,
CurrentPage: (uint32) 1
})
Subscriptions(subscriptions=[
<Subscription{
cancellation_dates=[],
data_source_uuid='ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11',
external_id='sub_0001',
subscription_set_external_id='set_001',
plan_uuid='pl_8da1caec-ee0b-11e6-a4d9-dbe62a1a1694',
uuid='sub_b8ba9b19-0d7d-401c-ad99-496104b435f1'}>,
<Subscription{
cancellation_dates=[],
data_source_uuid='ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11',
external_id='sub_0002',
plan_uuid='pl_8da1caec-ee0b-11e6-a4d9-dbe62a1a1694',
uuid='sub_00fbccd1-084d-4eec-9805-685ddafcd399'}>],
current_page=1,
total_pages=2,
customer_uuid='cus_c0dc8d74-edfd-11e6-a357-832dddba822f')
In the response, the customer_uuid
is the UUID of the customer whose subscriptions are listed.
subscriptions
contains an array of subscription
objects with the following data:
uuid
- The UUID of thesubscription
object generated by ChartMogul.external_id
- The unique external identifier for this subscription, as specified by you.subscription_set_external_id
- An optional unique external identifier for the subscription set to which this subscription belongs, as specified by you.plan_uuid
- The UUID of theplan
object generated by ChartMogul.data_source_uuid
- The UUID of the data source that this subscription plan belongs to.cancellation_dates
- An array ofcancelled_at
attributes specified by you. This is an array because a subscription may be re-activated and cancelled several times.
The other keys represent pagination attributes:
total_pages
- The total number of pages with results for this request.current_page
- The page number of this response.