Connect Subscriptions

Accepts details of two subscription objects that you want to connect.

Examples
curl -X POST "https://api.chartmogul.com/v1/customers/cus_f466e33d-ff2b-4a11-8f85-417eb02157a7/connect_subscriptions" \
       -u YOUR_API_KEY: \
       -H "Content-Type: application/json" \
       -d '{
                 "subscriptions": [
                                      {"data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
                                       "external_id": "d1c0c885-add0-48db-8fa9-0bdf5017d6b0"
                                      },
                                      {"data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
                                       "external_id": "9db5f4a1-1695-44c0-8bd4-de7ce4d0f1d4"
                                       }
                 ]
           }'
customer = ChartMogul::Customer.retrieve('cus_f466e33d-ff2b-4a11-8f85-417eb02157a7')
first_sub = customer.subscriptions.first
second_sub = customer.subscriptions.last

first_sub.connect(customer.uuid, [second_sub])
ChartMogul.Customer.connectSubscriptions(config, "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7", {
    "subscriptions": [{
            "data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
            "external_id": "d1c0c885-add0-48db-8fa9-0bdf5017d6b0"
        },
        {
            "data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
            "external_id": "9db5f4a1-1695-44c0-8bd4-de7ce4d0f1d4"
        }
    ]
})
<?php

ChartMogul\Customer::connectSubscriptions("cus_f466e33d-ff2b-4a11-8f85-417eb02157a7", [
    "subscriptions" => [
        [
            "data_source_uuid" => "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
            "external_id" => "d1c0c885-add0-48db-8fa9-0bdf5017d6b0",
        ],
        [
            "data_source_uuid" => "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
            "external_id" => "9db5f4a1-1695-44c0-8bd4-de7ce4d0f1d4",
        ],
    ]
]);
?>
api.ConnectSubscriptions("cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",[]cm.Subscription{
  {
    DataSourceUUID: "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
    ExternalID:     "d1c0c885-add0-48db-8fa9-0bdf5017d6b0",
  },
  {
    DataSourceUUID: "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
    ExternalID:     "9db5f4a1-1695-44c0-8bd4-de7ce4d0f1d4",
  },
})
chartmogul.Customer.connectSubscriptions(config, uuid='cus_f466e33d-ff2b-4a11-8f85-417eb02157a7', data={
  'subscriptions': [
    {
      "data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
      "external_id": "d1c0c885-add0-48db-8fa9-0bdf5017d6b0"
    },
    {
      "data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
      "external_id": "9db5f4a1-1695-44c0-8bd4-de7ce4d0f1d4"
    }
  ]
})
Result Format
{ }
true
{ }
true
None
<Customer{}>

Once a valid request is received by the API, it will respond with 202 - Accepted, and the subscriptions will be connected asynchronously.

📘

Connecting recently created subscriptions

If a subscription with the specified identifiers cannot be found, this endpoint will return the HTTP status 404. In this context, it is important to note that invoices that have been imported recently, may not have been fully processed, and related subscriptions not yet generated. It is thus recommended to wait for all imported invoices to be completely processed and reported in the dashboard, before placing API requests for connecting subscriptions.

Language