ChargebeeAPI

Create a customer

Idempotency Supported

Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API.

Creates a customer. You can create a customer and then create subscriptions for the customer when required. When creating a customer, you can pass along the billing address and card details.

Passing raw card data via API involves PCI liability at your end due to the sensitivity of the data. Instead, you can use one of the following integration options as applicable:

Here's some resources you can use to collect card information within your checkout form based on the payment gateway you use:

  • Stripe.js for Stripe users.
  • Braintree.js for Braintree users.
  • Accept.js, if you use Authorize.Net.
  • If you are using the Adyen gateway, you will have to use the Adyen's Client-Side Encryption to encrypt sensitive cardholder data. Once the cardholder data is encrypted, pass the value in adyen.encrypted.dataas temp token in this API.
  • You can also use our Hosted Pages based integration.

When billing address is not passed (say, for customers making offline payments), you can always provide it later using the Update billing info for a customer API.

Note: When an invoice is generated for a customer, the billing address provided for the customer is stored with the invoice. If the First Name, Last Name, and Company fields of the billing address do not contain any information, they're picked up from the customer details.

Sample Request

URL Format

POST https://[site].chargebee.com/api/v2/customers

Input Parameters

id
optional, string, max chars=50

Id for the new customer. If not given, this will be auto-generated.

first_name
optional, string, max chars=150

First name of the customer.

last_name
optional, string, max chars=150

Last name of the customer.

email
optional, string, max chars=70

Email of the customer. Configured email notifications will be sent to this email.

preferred_currency_code
optional, string, max chars=3

The currency code (ISO 4217 format) of the customer. Applicable if Multicurrency is enabled.

phone
optional, string, max chars=50

Phone number of the customer.

company
optional, string, max chars=250

Company name of the customer.

auto_collection
optional, enumerated string, default=on

Whether payments needs to be collected automatically for this customer.

Possible Enum Values
on

Whenever an invoice is created, an automatic attempt to charge the customer's payment method is made.

off

Automatic collection of charges will not be made. All payments must be recorded offline.

net_term_days
optional, integer, default=0

The number of days within which the customer has to make payment for the invoice.

allow_direct_debit
optional, boolean, default=false

Whether the customer can pay via Direct Debit.

vat_number
optional, string, max chars=20

The VAT/tax registration number for the customer. For customers with billing_address

country as XI (which is United Kingdom - Northern Ireland ), the first two characters of the full VAT number can be overridden by setting vat_number_prefix .

vat_number_prefix
optional, string, max chars=10

An overridden value for the first two characters of the full VAT number. Only applicable specifically for customers with billing_address

country as XI (which is United Kingdom - Northern Ireland ).

When you have enabled EU VAT in 2021 or have manually enabled the Brexit configuration, you have the option of setting billing_address

country as XI. That's the code for United Kingdom - Northern Ireland. The first two characters of the VAT number in such a case is XI by default. However, if the VAT number was registered in UK, the value should be GB. Set vat_number_prefix to GB for such cases.

entity_identifier_scheme
optional, string, max chars=50

The Peppol BIS scheme associated with the vat_number of the customer. This helps identify the specific type of customer entity. For example, DE:VAT is used for a German business entity while DE:LWID45 is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under billing_address.country. See list of possible values .

Tip:

If there are additional entity identifiers for the customer not associated with the vat_number, they can be provided as the entity_identifiers[] array.

entity_identifier_standard
optional, string, default=iso6523-actorid-upis, max chars=50

The standard used for specifying the entity_identifier_scheme. Currently only iso6523-actorid-upis is supported and is used by default when not provided.

Tip:

If there are additional entity identifiers for the customer not associated with the vat_number, they can be provided as the entity_identifiers[] array.

registered_for_gst
optional, boolean

Confirms that a customer is registered under GST. If set to true then the Reverse Charge Mechanism is applicable. This field is applicable only when Australian GST is configured for your site.

is_einvoice_enabled
optional, boolean

Determines whether the customer is e-invoiced. When set to true or not set to any value, the customer is e-invoiced so long as e-invoicing is enabled for their country (billing_address.country ). When set to false , the customer is not e-invoiced even if e-invoicing is enabled for their country.

Tip:

It is possible to set a value for this flag even when E-Invoicing is disabled. However, it comes into effect only when E-Invoicing is enabled.

einvoicing_method
optional, enumerated string

Determines whether to send einvoice manually or automatic.

Possible Enum Values
automatic

Use this value to send e-invoice every time an invoice or credit note is created.

manual

When manual is selected the automatic e-invoice sending is disabled. Use this value to send e-invoice manually through UI or API.

site_default

The default value of the site which can be overridden at the customer level.

taxability
optional, enumerated string, default=taxable

Specifies if the customer is liable for tax.

Possible Enum Values
taxable

Computes tax for the customer based on the site configuration. In some cases, depending on the region, shipping_address is needed. If not provided, then billing_address is used to compute tax. If that's not available either, the tax is taken as zero.

exempt
  • Customer is exempted from tax. When using Chargebee's native Taxes feature or when using the TaxJar integration, no other action is needed.
  • However, when using our Avalara integration, optionally, specify entity_code or exempt_number attributes if you use Chargebee's AvaTax for Sales or specify exemption_details attribute if you use Chargebee's AvaTax for Communications integration. Tax may still be applied by Avalara for certain values of entity_code/exempt_number/exemption_details based on the state/region/province of the taxable address.
exemption_details
optional

Indicates the exemption information. You can customize customer exemption based on specific Location, Tax level (Federal, State, County and Local), Category of Tax or specific Tax Name. This is applicable only if you use Chargebee's AvaTax for Communications integration. To know more about what values you need to provide, refer to this Avalara's API document .

customer_type
optional, enumerated string

Indicates the type of the customer. This is applicable only if you use Chargebee's AvaTax for Communications integration.

Possible Enum Values
residential

When the purchase is made by a customer for home use

business

When the purchase is made at a place of business

senior_citizen

When the purchase is made by a customer who meets the jurisdiction requirements to be considered a senior citizen and qualifies for senior citizen tax breaks

industrial

When the purchase is made by an industrial business

client_profile_id
optional, string, max chars=50

Indicates the Client profile id for the customer. This is applicable only if you use Chargebee's AvaTax for Communications integration.

taxjar_exemption_category
optional, enumerated string

Indicates the exemption type of the customer. This is applicable only if you use Chargebee's TaxJar integration.

Possible Enum Values
wholesale

Whole-sale

government

Government

other

Other

business_customer_without_vat_number
optional, boolean

Confirms that a customer is a valid business without an EU/UK VAT number.

locale
optional, string, max chars=50

Determines which region-specific language Chargebee uses to communicate with the customer. In the absence of the locale attribute, Chargebee will use your site's default language for customer communication.

entity_code
optional, enumerated string

The exemption category of the customer, for USA and Canada. Applicable if you use Chargebee's AvaTax for Sales integration .

Possible Enum Values
a

Federal government

b

State government

c

Tribe/Status Indian/Indian Band

d

Foreign diplomat

e

Charitable or benevolent organization

exempt_number
optional, string, max chars=100

Any string value that will cause the sale to be exempted. Use this if your finance team manually verifies and tracks exemption certificates. Applicable if you use Chargebee's AvaTax for Sales integration .

meta_data
optional, jsonobject

A collection of key-value pairs that provides extra information about the customer.

Note: There's a character limit of 65,535.

Learn more .

offline_payment_method
optional, enumerated string

The preferred offline payment method for the customer.

Possible Enum Values
no_preference

No Preference

cash

Cash

check

Check

bank_transfer

Bank Transfer

ach_credit

ACH Credit

auto_close_invoices
optional, boolean

Override for this customer, the site-level setting for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute is also available at the subscription level which takes precedence.

consolidated_invoicing
optional, boolean

Indicates whether invoices raised on the same day for the customer are consolidated. When provided, this overrides the default configuration at the site-level. This parameter can be provided only when Consolidated Invoicing is enabled.

Note:

Any invoices raised when a subscription activates from in_trial or future status, are not consolidated by default. Contact Support to enable consolidation for such invoices.

.

token_id
optional, string, max chars=40

The Chargebee payment token generated by Chargebee JS.

Note: The payment token created via Chargebee JS uses the gateway selected through Smart Routing. Explicitly passing a gateway_id in this API call will not override the gateway associated with the token.

invoice_notes
optional, string, max chars=2000

A customer-facing note added to all invoices associated with this API resource. This note becomes one among all the notes displayed on the invoice PDF.

card[0..n]
Parameters for card
pass parameters as card[<param name>]
bank_account[0..n]
Parameters for bank_account
pass parameters as bank_account[<param name>]
payment_method[0..n]
Parameters for payment_method
pass parameters as payment_method[<param name>]
payment_intent[0..n]
Parameters for payment_intent
pass parameters as payment_intent[<param name>]
billing_address[0..n]
Parameters for billing_address
pass parameters as billing_address[<param name>]
entity_identifiers[0..n]
Parameters for entity_identifiers. Multiple entity_identifiers can be passed by specifying unique indices.
pass parameters as entity_identifiers[<param name>][<idx:0..n>]
tax_providers_fields[0..n]
Parameters for tax_providers_fields. Multiple tax_providers_fields can be passed by specifying unique indices.
pass parameters as tax_providers_fields[<param name>][<idx:0..n>]

Returns

customerCustomer object
Resource object representing customer
cardCard object
Resource object representing card