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.
More details {#transfer-more}
Prerequisites {#prerequisites}
- Transfers must always be initiated for an active
customer
resources and never for a deprecated resources. - A
customer
resource cannot be transferred more than three times in a single calendar year. For example, if already moved thrice in the year 2023, acustomer
resource can only be moved again in 2024. - The
customer
resource must not have any of the following:- An account hierarchy relationship.
subscription
resource withstatus
in_trial
or- advance invoice schedules. (subscription.has_scheduled_advance_invoices as
true
.)
- invoice resource with
status
aspending
. (Close pending invoices before invoking this API.) invoice
resources that are advance invoices. (invoice.has_advance_charges astrue
.)- quote resources with
status
asopen
oraccepted
. - transaction resource with:
status
asin_progress
orstatus
assuccess
,type
asauthorization
, 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
customer
resource must not be a gifter of a gift subscription with statusscheduled
orunclaimed
.
Mechanics of business entity transfer {#mechanics}
When calling this endpoint, the active and deprecated resources are processed as follows:
- For the active resource:
id
andactive_id
are set to match the deprecated resource'sid
.business_entity_id
is set todestination_business_entity_id
parameter.
- For the deprecated resource:
- For
customer
andsubscription
resources, the value ofactive_id
is set to match the resourceid
. - The value of
id
is changed to a new random value.
- For
Considerations for business entity transfer {#considerations}
- When this API is endpoint is called, Chargebee blocks concurrent calls to incompatible
POST
operations. - When a resource is transferred more than once, each transfer deprecates the previous active resource and creates a new active resource.
payment_source
resources linked to thecustomer
are immediately transferred to the destination business entity.subscription
resources linked to thecustomer
are transferred automatically to the destination business entity as follows:active
subscription resources are transferred on their next renewal.paused
subscription resources are transferred when resumed.future
subscription resources are transferred on their start_date.non_renewing
andcancelled
subscription 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
customer
andsubscription
resources 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 {#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
. screenshot|transfer_resource_1.jpg
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.
screenshot|transfer_resource_2.jpg
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
.
screenshot|transfer_resource_3.jpg
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 Possible 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 Possible 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-event-email |
String | No |
skip only emails Possible values:
|
Request body fields
Name | Type | Required | Description |
---|---|---|---|
active_resource_ids[] |
Array | Yes |
The list of unique identifiers of the 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.