Introducing the Better Auth Chargebee plugin: Use it to handle subscriptions, billing, and auth seamlessly.
Chargebeechargebee API

Create a customer

Idempotency Supported

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 credit card details to through the API involves PCI liability at your end as sensitive card information passes through your servers. If you wish to avoid that, you can use one of the following integration methodologies if applicable:

  • If you use Stripe, you can also use Stripe.js with your checkout form, to collect card information.
  • If you are using Braintree gateway, you can use Braintree.js with your checkout form.
  • You can also use our Hosted Pages based integration.

The Billing Address is significant especially when EU VAT taxes are involved, for tax calculations will be based on this address. For customers without a billing address, EU VAT taxes will not be included. Thus ensure to set this properly if you have configured EU VAT Tax.

Billing Address attributes shall be explicitly passed for customers paying offline(Cash, Check, Bank Transfer etc).

Note: When an invoice is generated for a customer, the billing address provided for the customer will be stored with the invoice. If the First Name, Last Name, and Company fields do not contain any information under Billing Info, the same will be picked from Customer Details if the same is available there.

Sample Request

creates a customer with billing address.

Sample Result[JSON]

URL Format

POST https://[site].chargebee.com/api/v1/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.

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.

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.

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 .

taxability
optional, enumerated string, default=taxable

Specifies if the customer is liable for tax.

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.
meta_data
optional, jsonobject

A set of key-value pairs stored as additional information for the customer. Learn more .

created_from_ip
optional, string, max chars=50

The IP address of the customer. Used primarily for referral integrations and EU/UK VAT validation.

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
Parameters for card
pass parameters as card[<param name>]
payment_method
Parameters for payment_method
pass parameters as payment_method[<param name>]
payment_intent
Parameters for payment_intent
pass parameters as payment_intent[<param name>]
billing_address
Parameters for billing_address
pass parameters as billing_address[<param name>]

Returns

Customer object
Resource object representing customer
Card object
Resource object representing card