Accepts details of two customer
objects that you want to merge.
# Example using Customer UUIDs to identify 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 to identify 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" },
});
// 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"},
},
)
{}
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.
Automatic merging of duplicate customers
ChartMogul allows you to create an automation to merge duplicate customers based on their external ID, domain (website URL), or company name. Learn more.
Merged customers
When customers are merged, two or more
data source customer
objects become the children of onecustomer
object. Data associated with eachdata source customer
, such as invoices and transactions, remains in the source where it was originally added. Learn more.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 attribute with different values, the value retained for the field will be that of the customer specified ininto
.You can see the merged customer reported in your ChartMogul account.
For uploading Invoices to the merged customer, additional data (
data_source_uuid
andcustomer_external_id
) needs to be provided in the invoice object. Details of the implementation can be found in Import Invoices section of the documentation.
Unmerging customers
Use the Unmerge Customers endpoint to unmerge previously merged customers.