Merge Customers

Accepts details of two customer objects that you want to merge.

Examples
# Example using Customer UUIDs for identifying customers to merge

curl -X POST "https://api.chartmogul.com/v1/customers/merges" \
       -u YOUR_API_KEY: \
       -H "Content-Type: application/json" \
       -d '{
             "from": {"customer_uuid": "cus_5915ee5a-babd-406b-b8ce-d207133fb4cb"},
             "into": {"customer_uuid": "cus_2123290f-09c8-4628-a205-db5596bd58f7"}
           }'
           
# Example using Data Source UUIDs and External IDs for identifying customers to merge

curl -X POST "https://api.chartmogul.com/v1/customers/merges" \
       -u YOUR_API_KEY: \
       -H "Content-Type: application/json" \
       -d {
             "from": {"data_source_uuid": "ds_ade45e52-47a4-231a-1ed2-eb6b9e541213",
                      "external_id": "cus_187544"},
             "into": {"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
                      "external_id": "34916129"}
           }
# Example using Customer UUIDs

from_customer = ChartMogul::Customer.retrieve('cus_5915ee5a-babd-406b-b8ce-d207133fb4cb')
into_customer = ChartMogul::Customer.retrieve('cus_2123290f-09c8-4628-a205-db5596bd58f7')

from_customer.merge_into!(into_customer)
// Example using Customer UUIDs
ChartMogul.Customer.merge(config, {
  "from": {"customer_uuid": "cus_5915ee5a-babd-406b-b8ce-d207133fb4cb"},
  "into": {"customer_uuid": "cus_2123290f-09c8-4628-a205-db5596bd58f7"}
})
<?php

// Example using Customer UUIDs
ChartMogul\Customer::merge([
    "customer_uuid" => "cus_5915ee5a-babd-406b-b8ce-d207133fb4cb"
        ], [
    "customer_uuid" => "cus_2123290f-09c8-4628-a205-db5596bd58f7"
]);
?>
// Example using Customer UUIDs
api.MergeCustomers(&cm.MergeCustomersParams{
  From: cm.CustID{CustomerUUID: "cus_5915ee5a-babd-406b-b8ce-d207133fb4cb"},
  Into:   cm.CustID{CustomerUUID: "cus_2123290f-09c8-4628-a205-db5596bd58f7"},
})
# Example using Customer UUIDs
chartmogul.Customer.merge(config, data={
    "from": {
        "customer_uuid": "cus_5915ee5a-babd-406b-b8ce-d207133fb4cb"
    },
    "into": {
        "customer_uuid": "cus_2123290f-09c8-4628-a205-db5596bd58f7"
    }
})
Result Format
{ }
true
{ }
true
None
<Customer{}>

Once a valid request is received by the API, it will respond with 202 - Accepted, and the merging function will proceed to work asynchronously.

📘

Merged customers

The merged customer will have the ChartMogul Customer UUID, email address, and location of the customer identified using the into key. Both customers’ external IDs, tags, custom attributes, and notes will be preserved. Subscriptions, MRR movements and transactions will be collated and ordered by date. If both customers have the same custom field, the value retained for the field will be that of the customer specified in into.

You can see the merged customer reported in your ChartMogul account.

For uploading Invoices to the merged customer, additional data (data_source_uuid and customer_external_id) needs to be provided in the invoice object. Details of the implementation can be found in Import Invoices section of the documentation.

Language
Authorization
Basic
base64
: