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}

Mechanics of business entity transfer {#mechanics}

When calling this endpoint, the active and deprecated resources are processed as follows:

  1. For the active resource:
    1. id and active_id are set to match the deprecated resource's id.
    2. business_entity_id is set to destination_business_entity_id parameter.
  2. For the deprecated resource:
    1. For customer and subscription resources, the value of active_id is set to match the resource id.
    2. The value of id is changed to a new random value.

Considerations for business entity transfer {#considerations}

See also

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

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:

  • "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

Possible 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

Possible 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.