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

Prerequisites

<h4 id="mechanics">Mechanics of business entity transfer</h4>
<p>When calling this endpoint, the active and deprecated resources are processed as follows:</p>

<ol>
    <li>For the active resource:</li>
    <ol>
        <li><code>id</code> and <code>active_id</code> are set to match the deprecated resource's <code>id</code>.</li>
        <li><code>business_entity_id</code> is set to <code>destination_business_entity_id</code> parameter.</li>
    </ol>
    <li>For the deprecated resource:</li>
    <ol>
        <li>For <code>customer</code> and <code>subscription</code> resources, the value of <code>active_id</code> is set to match the resource <code>id</code>.</li>
        <li>The value of <code>id</code> is changed to a new random value.</li>
    </ol>
</ol>

<h4 id="considerations">Considerations for business entity transfer</h4>
<ul>
    <li>When this API is endpoint is called, Chargebee blocks concurrent calls to incompatible <code>POST</code> operations.</li>
    <li>When a resource is transferred more than once, each transfer deprecates the previous active resource and creates a new active resource.</li>
    <li><code>payment_source</code> resources linked to the <code>customer</code> are immediately transferred to the destination business entity.</li>
    <li><code>subscription</code> resources linked to the <code>customer</code> are transferred automatically to the destination business entity as follows:</li>
    <ul>
        <li><code>active</code> subscription resources are transferred on their next renewal. </li>
        <li><code>paused</code> subscription resources are transferred when resumed.</li>
        <li><code>future</code> subscription resources are transferred on their <code><a href='subscriptions?prod_cat_ver=2#subscription_start_date'>start_date</a></code>.</li>
        <li><code>non_renewing</code> and <code>cancelled</code> subscription resources are not transferred and remain linked to the deprecated customer resource.</li>
    </ul>
    <li>Other resources linked to the customer, such as <code>invoice</code>, <code>quote</code>, <code>credit_note</code>, and <code>transaction</code>, remain linked to the deprecated customer resource.</li>
    <li>Deprecated <code>customer</code> and <code>subscription</code> resources are not returned in list APIs such as <a href='customers?prod_cat_ver=2#list_customers'>List customers</a> or <a href='subscriptions?prod_cat_ver=2#list_subscriptions'>List subscriptions</a>.</li>
</ul>

<div class='alert alert-info'>
    <strong>See also</strong>
    <ul>
        <li><a href='https://www.chargebee.com/docs/2.0/mbe-data-management-actions.html' target='_blank'>Permitted operations</a> on deprecated and active resources.</li>
        <li><a href='https://www.chargebee.com/docs/2.0/mbe-about-resources-and-managing-associated-workflow-processes.html' target='_blank'>Additional considerations for business entity transfer.</a></li>
    </ul>
</div>

<h4 id="example">Example</h4>
<p>The following example illustrates the transfer of a <code>customer</code> resource from a business entity (source) to another (destination). The example also shows how <code><a href='payment_sources?prod_cat_ver=2'>payment_source</a></code>, <code>subscription</code>, and <code>invoice</code> resources attached to the <code>customer</code> resource are affected.</p>

<h5>1. Initial state before the transfer</h5>

Imagine a <code>customer</code> resource with the <code>id</code> <code>Ab6dRFt</code> belonging to the business entity <code>acme-us</code>. This customer has a linked <code>payment_source</code>, <code>subscription</code>, and an <code>invoice</code>.

<docs-snippet>screenshot|transfer_resource_1.jpg</docs-snippet>

<h5>2. Invoking the API endpoint</h5>

<p>To transfer the <code>customer</code> resource to a new business entity <code>acme-eu</code>, you would call the endpoint as follows:</p>
<div class="cb-code-io" data-swiftype-index='false'>
    <code class="prettyprint lang-shell">

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"

<p>The <code>customer</code> resource is deprecated in favor of a new active <code>customer</code> resource. Notice that the <code>id</code> of the deprecated <code>customer</code> resource is transferred to the new, active <code>customer</code> resource. Meanwhile, the deprecated resource is assigned a new random <code>id</code>.</p>

<p>The <code>payment_source</code> resource is also deprecated and a new active <code>payment_source</code> resource is created and linked to the new <code>customer</code> resource. Here too, the active resource adopts the <code>id</code> of the deprecated <code>payment_source</code>, which in turn is assigned a new random <code>id</code>.</p>

<p>The <code>subscription</code> and <code>invoice</code> resources remain linked to the deprecated <code>customer</code> resource.</p>

<docs-snippet>screenshot|transfer_resource_2.jpg</docs-snippet>

<h5>3. Transfer of linked <code>subscription</code> resources</h5>

<p>When the <code>subscription</code> renews, it automatically transfers to the business entity of the active <code>customer</code> resource. This process mirrors the transfer of the <code>customer</code> resource, resulting in a new active <code>subscription</code> resource linked to the active <code>customer</code> resource and the business entity <code>acme-eu</code>.
</p>

<docs-snippet>screenshot|transfer_resource_3.jpg</docs-snippet>

Servers

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:

  • "all-disabled"
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:

  • "all-disabled"
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:

  • "all-disabled"

Request body fields

Name Type Required Description
active_resource_ids[] Array Yes

The list of unique identifiers of the customer resources to be transferred. Each id must belong to an active customer resource.

Note

If a customer resource was deprecated because it was moved previously, you cannot move it again. Instead, move the active version of the resource. Do this by passing the active_id of the deprecated resource.

reason_codes[] Array Yes

The list of reasons for changing the business entity of the corresponding customer resources.

destination_business_entity_ids[] Array Yes

The list of unique identifiers of the business_entity resources to which the corresponding customer resource must be transferred.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. 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.
  3. Click Test request to test run your request to the API and see the API's response.