Disconnect Subscriptions
POST https://api.chartmogul.com/v1/customers/CUSTOMER_UUID/disconnect_subscriptions
Accepts details of two subscription objects that you want to disconnect.
# Using data_source_uuid and subscription external_id to disconnect two subscriptions
curl -X POST "https://api.chartmogul.com/v1/customers/cus_f466e33d-ff2b-4a11-8f85-417eb02157a7/disconnect_subscriptions" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"subscriptions": [
{
"data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
"external_id": "sub_0001"
},
{
"data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
"external_id": "sub_0002"
}
]
}'
# Or using data_source_uuid and subscriptions uuid to disconnect two subscriptions
curl -X POST "https://api.chartmogul.com/v1/customers/cus_f466e33d-ff2b-4a11-8f85-417eb02157a7/disconnect_subscriptions" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"subscriptions": [
{
"data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
"uuid": "sub_d1c0c885-add0-48db-8fa9-0bdf5017d6b0"
},
{
"data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
"uuid": "sub_9db5f4a1-1695-44c0-8bd4-de7ce4d0f1d4"
}
]
}'
data_source_uuid = "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213"
customer_uuid = "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7"
subscriptions = ChartMogul::Metrics::Customers::Subscription.all(customer_uuid)
ChartMogul::Metrics::Customers::Subscriptions.disconnect(
data_source_uuid,
customer_uuid,
subscriptions.entries
)
ChartMogul.Metrics.Customer.disconnectSubscriptions(
config,
"ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
"cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
[
{
uuid: "f4e293d2-50a8-4ef2-b130-8190318fa0ce",
},
{
uuid: "23f5a995-e3ce-4072-b89a-609074bebd74",
},
]
)
$data_source_uuid = "ds_20bbb506-d69a-11f0-a876-535e2d78a156";
$customer_uuid = "cus_c9352490-8d66-403c-90c5-01663aae2959";
$subscriptions = MetricsSubscription::all(['customer_uuid' => $customer_uuid, 'per_page' => 10]);
MetricsSubscription::disconnect($data_source_uuid, $customer_uuid, $subscriptions->entries);
dataSourceUUID := "ds_20bbb506-d69a-11f0-a876-535e2d78a156"
customerUUID := "cus_c9352490-8d66-403c-90c5-01663aae2959"
api.MetricsDisconnectSubscriptions(dataSourceUUID, customerUUID, []cm.MetricsCustomerSubscription{
{
UUID: "ade45e52-47a4-231a-1ed2-eb6b9e541213",
},
{
UUID: "28deaa2b-1c99-4e86-8bd5-64f6b62dc236",
},
})
chartmogul.Customer.disconnectSubscriptions(
config,
uuid="cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
data={
"subscriptions": [
{
"data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
"uuid": "a8640a5a-0d43-41c7-803e-76fc042267b0",
},
{
"data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
"uuid": "a8640a5a-0d43-41c7-803e-76fc042267b0",
},
]
},
)
{}
true
{}
true
None
<Customer{}>
Disconnect subscriptions using data_source_uuid and external_id.
If you want to disconnect two subscriptions with the same subscription external id from the same data source (e.g. canceled and reactivated subscription), use data_source_uuid and uuid. The uuid of the subscription can be found via List Customer Subscriptions API query. The endpoint will return a 400 HTTP error when using data_source_uuid and external_id.
Query parameters
customer_uuidstring optional- The ChartMogul UUID of the Customer whose subscriptions you need to disconnect.
Body parameters
subscriptionsarray(object) required- Identifiers for two or more subscriptions that you want to disconnect.
Response
Once a valid request is received by the API, it will respond with 202 - Accepted, and the subscriptions will be disconnected asynchronously.