POST /business_entities/transfers
Important This API will not work if you have specified a business entity in the custom HTTP header.
Transfers one or more customer resources from one business entity to another.
The transfer is executed by creating a copy of the customer resource. The original resource is deprecated, while the new copy becomes the active resource.
Prerequisites
-
Transfers must always be initiated for an active
customerresources and never for a deprecated resources. -
A
customerresource cannot be transferred more than three times in a single calendar year. For example, if already moved thrice in the year 2023, acustomerresource can only be moved again in 2024. -
The
customerresource must not have any of the following:-
An account hierarchy
relationship. -
subscriptionresource withstatusin_trialor- advance invoice schedules. (
subscription.has_scheduled_advance_invoicesastrue.)
-
invoiceresource withstatusaspending. (Close pending invoices before invoking this API.) -
invoiceresources that are advance invoices. (invoice.has_advance_chargesastrue.) -
quoteresources withstatusasopenoraccepted. -
transactionresource with:statusasin_progressorstatusassuccess,typeasauthorization, and a non-zeroamount_capturable.
-
Non-zero
unbilled_charges. (Invoice unbilled charges before invoking this API.) -
Non-zero
refundable_credits. (Apply credits to unpaid invoices before invoking this API.)
-
-
The
customerresource must not be a gifter of a gift subscription withstatusscheduledorunclaimed.
Mechanics of business entity transfer
When calling this endpoint, the active and deprecated resources are processed as follows:
-
For the active resource:
idandactive_idare set to match the deprecated resource'sid.business_entity_idis set todestination_business_entity_idparameter.
-
For the deprecated resource:
- For
customerandsubscriptionresources, the value ofactive_idis set to match the resourceid. - The value of
idis changed to a new random value.
- For
Considerations for business entity transfer
-
When this API is endpoint is called, Chargebee blocks concurrent calls to incompatible
POSToperations. -
When a resource is transferred more than once, each transfer deprecates the previous active resource and creates a new active resource.
-
payment_sourceresources linked to thecustomerare immediately transferred to the destination business entity. -
subscriptionresources linked to thecustomerare transferred automatically to the destination business entity as follows:activesubscription resources are transferred on their next renewal.pausedsubscription resources are transferred when resumed.futuresubscription resources are transferred on theirstart_date.non_renewingandcancelledsubscription resources are not transferred and remain linked to the deprecated customer resource.
-
Other resources linked to the customer, such as
invoice,quote,credit_note, andtransaction, remain linked to the deprecated customer resource. -
Deprecated
customerandsubscriptionresources are not returned in list APIs such as List customers or List subscriptions.
See also
- Permitted operations on deprecated and active resources.
- Additional considerations for business entity transfer.
Example
The following example illustrates the transfer of a customer resource from a business entity (source) to another (destination). The example also shows how payment_source, subscription, and invoice resources attached to the customer resource are affected.
1. Initial state before the transfer
Imagine a customer
resource with the id
Ab6dRFt
belonging to the business entity acme-us
. This customer has a linked payment_source
, subscription
, and an invoice
.
2. Invoking the API endpoint
To transfer the customer resource to a new business entity acme-eu, you would call the endpoint as follows:
curl https://{site}.chargebee.com/api/v2/business_entities/transfers \
-u {api_key}:\
-d active_resource_ids[0]="Ab6dRFt" \
-d destination_business_entity_ids[0]="acme-us" \
-d reason_code[0]="correction"
The customer resource is deprecated in favor of a new active customer resource. Notice that the id of the deprecated customer resource is transferred to the new, active customer resource. Meanwhile, the deprecated resource is assigned a new random id.
The payment_source resource is also deprecated and a new active payment_source resource is created and linked to the new customer resource. Here too, the active resource adopts the id of the deprecated payment_source, which in turn is assigned a new random id.
The subscription and invoice resources remain linked to the deprecated customer resource.
3. Transfer of linked subscription resources
When the subscription renews, it automatically transfers to the business entity of the active customer resource. This process mirrors the transfer of the customer resource, resulting in a new active subscription resource linked to the active customer resource and the business entity acme-eu.
Servers
- {protocol}://{site}.{environment}:{port}/api/v2
- {protocol}://{site}-test.{environment}:{port}/api/v2
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
chargebee-request-origin-device |
String | No |
The device from which the customer has made the request |
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/x-www-form-urlencoded" |
chargebee-event-webhook |
String | No |
skip only webhooks Valid values:
|
chargebee-business-entity-id |
String | No |
If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
chargebee-event-actions |
String | No |
skip all actions to be done on the events Valid values:
|
chargebee-request-origin-user |
String | No |
The email address of your customer/user. Use this when the email address has only ASCII characters. |
chargebee-request-origin-ip |
String | No |
The IP address of the customer where the request originated |
chargebee-request-origin-user-encoded |
String | No |
The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header chargebee-request-origin-user is ignored. |
chargebee-event-email |
String | No |
skip only emails Valid values:
|
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
active_resource_ids[] |
Array | Yes |
The list of unique identifiers of the Note
If a |
reason_codes[] |
Array | Yes |
The list of reasons
for changing the business entity of the corresponding |
destination_business_entity_ids[] |
Array | Yes |
The list of unique identifiers of the |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.