POST /customers
Creates a customer resource. Optionally, creates a payment source for the customer.
Creating payment source
Although this operation supports creation of a customer with a payment source, it is recommended to use one of the Payment Source APIs to capture payment source details instead of using this operation. This way, even if payment source creation fails due to errors at the payment gateway, the customer resource can still be created successfully.
Impacts
Customer
- If the multi-business entity feature is enabled, the customer is linked to the business entity specified; otherwise, the customer record is linked to the default business entity defined for the site.
Invoices
- Chargebee uses the
billing_addressobject from the customer to set the values in thebilling_addressof the invoices generated for the customer. - If the
billing_addressobject does not include thefirst_name,last_name, orcompanyfields, Chargebee automatically uses the values fromcustomer.first_name,customer.last_name, andcustomer.company(if available) when generating invoices.
Payment source
- If
payment_intentorpayment_methodparameter is passed, apayment_sourceresource of the appropriate type is created for the customer. - If
bank_accountparameter is passed, apayment_sourceresource oftypedirect_debitis created for the customer. - If
cardparameter is passed, apayment_sourceresource oftypecardis created for the customer.
Integrations
- If CRM systems are connected to Chargebee, a corresponding record is created in the connected CRM (such as Salesforce, and HubSpot).
Use Cases
Create payment source using payment_intent
Use the payment_intent parameter to create a payment source for the customer. Using payment intents is the recommended way to create a payment source in Chargebee for both Strong Customer Authentication (SCA) (i.e. 3D-Secure) and non-SCA flows.
- Create a
payment_intentresource by calling the Create a payment intent API. - Pass the
payment_intentobject to your frontend and use Chargebee.js to capture the payment source details from the customer. Use Payment Method Helpers to show payment method UIs and collect payment method details from the customer. - Listen to the
payment_intent_updatedevent. Once thepayment_intent.statusisauthorized, pass thepayment_intent.idusing thepayment_intent[id]parameter in this API call.
Create payment source using payment_method
If you prefer to use the payment gateway's SDKs to capture the payment method details, you can then use the payment_method parameter in this API to pass the payment method token and other details.
- Use the JavaScript library of your payment gateway to capture the payment method details. Examples include:
- Stripe.js
- Braintree.js
- Accept.js (if you use Authorize.Net)
- Adyen's Client-Side Encryption (if you use Adyen)
- Pass the payment method token using the
payment_method[reference_id]orpayment_method[tmp_token]parameter along with any additional parameters required by the payment gateway to create the payment source.
Create payment source using bank_account
You can pass raw bank account details via this API. Use the bank_account parameter to pass the bank account details.
Create payment source using card
If you are PCI compliant, you can pass raw card details via this API. Use the card parameter to pass the card details.
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 Valid 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 Valid 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-request-origin-user is ignored. |
chargebee-event-email |
String | No |
skip only emails Valid values:
|
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
first_name |
String | No |
First name of the customer. |
business_entity_id |
String | No |
The unique ID of the business entity this customer should be linked to. An alternative way of passing this parameter is by means of a custom HTTP header.
|
entity_identifiers |
Object | No |
Parameters for entity_identifiers |
entity_identifiers.id[] |
Array | No |
The unique id for the |
entity_identifiers.value[] |
Array | No |
The value of the Tip: If there is only one entity identifier for the customer and the value is the same as |
entity_identifiers.scheme[] |
Array | No |
The Peppol BIS scheme associated with the Tip: If there is only one entity identifier for the customer and the value is the same as |
entity_identifiers.standard[] |
Array | No |
The standard used for specifying the Tip: If there is only one entity identifier for the customer and the value is the same as |
customer_type |
String | No |
Indicates the type of the customer. This is applicable only if you use Chargebee's AvaTax for Communications integration. * industrial - When the purchase is made by an industrial business * residential - When the purchase is made by a customer for home use * 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 * business - When the purchase is made at a place of business Valid values:
|
invoice_notes |
String | No |
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. |
payment_method |
Object | No |
Parameters for payment_method |
payment_method.gateway_account_id |
String | No |
The gateway account in which this payment source is stored. |
payment_method.type |
String | No |
The type of payment method. For more details refer Update payment method for a customer API under Customer resource. * google_pay - Payments made via Google Pay. * pix - Payments made via Pix * pay_by_bank - Pay By Bank * sofort - Payments made via Sofort. * netbanking_emandates - Netbanking (eMandates) Payments. * apple_pay - Payments made via Apple Pay. * unionpay - Payments made via UnionPay. * giropay - Payments made via giropay. * direct_debit - Represents bank account for which the direct debit or ACH agreement/mandate is created. * bancontact - Payments made via Bancontact Card. * upi - UPI Payments. * stablecoin - Payments made via Stablecoin * alipay - Payments made via Alipay. Payments made via PayTo * wechat_pay - Payments made via WeChat Pay. Payments made via Sepa Instant Transfer * dotpay - Payments made via Dotpay. * paypal_express_checkout - Payments made via PayPal Express Checkout. * ideal - Payments made via iDEAL. * electronic_payment_standard - Electronic Payment Standard * generic - Payments made via Generic Payment Method. * klarna_pay_now - Payments made via Klarna Pay Now * faster_payments - Payments made via Faster Payments * venmo - Payments made via Venmo * payconiq_by_bancontact - Payments made via Payconiq by Bancontact * automated_bank_transfer - Represents virtual bank account using which the payment will be done. * amazon_payments - Payments made via Amazon Payments. * card - Card based payment including credit cards and debit cards. Details about the card can be obtained from the card resource. * online_banking_poland - Payments made via Online Banking Poland * trustly - Trustly * kbc_payment_button - KBC Payment Button Valid values:
|
payment_method.tmp_token |
String | No |
Single-use tokens created by payment gateways. In Stripe, a single-use token is created for Apple Pay Wallet, card details or direct debit. In Braintree, a nonce is created for Apple Pay Wallet, PayPal, or card details. In Authorize.Net, a nonce is created for card details. In Adyen, an encrypted data is created from the card details. |
payment_method.issuing_country |
String | No |
ISO 3166 alpha-2 country code . Note: If you enter an invalid country code, the system will return an error. If you have enabled EU VAT
in 2021 or have manually enabled
the Brexit configuration, then |
payment_method.additional_information |
Object | No |
|
payment_method.reference_id |
String | No |
The reference id. In the case of Amazon and PayPal this will be the billing agreement id . For GoCardless direct debit this will be 'mandate id'. In the case of card this will be the identifier provided by the gateway/card vault for the specific payment method resource. Note: This is not the one-time temporary token provided by gateways like Stripe. For more details refer Update payment method for a customer API under Customer resource. |
entity_identifier_scheme |
String | No |
The Peppol BIS scheme associated with the Tip: If there are additional entity identifiers for the customer not associated with the |
vat_number |
String | No |
The VAT/tax registration number for the customer. For customers with
|
id |
String | No |
Id for the new customer. If not given, this will be auto-generated. |
email |
String | No |
Email address of the customer. Configured email notifications are sent to this email address. Invalid email address will result in an error. |
net_term_days |
Integer | No |
The number of days within which the customer has to make payment for the invoice. Default value: 0 |
company |
String | No |
Company name of the customer. |
tax_providers_fields |
Object | No |
Parameters for tax_providers_fields |
tax_providers_fields.field_value[] |
Array | No |
The value of the related tax field |
tax_providers_fields.field_id[] |
Array | No |
Field id of the attribute which tax vendor has provided while getting onboarded with Chargebee. |
tax_providers_fields.provider_name[] |
Array | No |
Name of the tax provider. |
auto_collection |
String | No |
Whether payments needs to be collected automatically for this customer. Constraints
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. Valid values:
Default value: "on" |
locale |
String | No |
Determines which region-specific language Chargebee uses to communicate with the customer. Use the language pack to customize the translations for each locale. Constraints
Prerequisite
Default behavior
|
preferred_currency_code |
String | No |
The currency code (in ISO 4217 format) of the customer.
|
taxjar_exemption_category |
String | No |
Indicates the exemption type of the customer. This is applicable only if you use Chargebee's TaxJar integration. * other - Other * government - Government * wholesale - Whole-sale Valid values:
|
is_einvoice_enabled |
Boolean | No |
Determines whether the customer is e-invoiced. When set to 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. |
billing_address |
Object | No |
Parameters for billing_address |
billing_address.first_name |
String | No |
The first name of the billing contact. |
billing_address.state |
String | No |
The state/province name. Is set by Chargebee automatically for US, Canada and India If |
billing_address.city |
String | No |
The name of the city. |
billing_address.validation_status |
String | No |
The address verification status. * valid - Address was validated successfully. * partially_valid - The address is valid for taxability but has not been validated for shipping. * invalid - Address is invalid. * not_validated - Address is not yet validated. Valid values:
Default value: "not_validated" |
billing_address.line2 |
String | No |
Address line 2 |
billing_address.line1 |
String | No |
Address line 1 |
billing_address.email |
String | No |
The email address. |
billing_address.last_name |
String | No |
The last name of the billing contact. |
billing_address.company |
String | No |
The company name. |
billing_address.line3 |
String | No |
Address line 3 |
billing_address.state_code |
String | No |
The ISO 3166-2 state/province code
without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set |
billing_address.zip |
String | No |
Zip or postal code. The number of characters is validated according to the rules specified here . |
billing_address.phone |
String | No |
The phone number. |
billing_address.country |
String | No |
The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code . Brexit If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then |
taxability |
String | No |
Specifies if the customer is liable for tax. * 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 -
Valid values:
Default value: "taxable" |
consolidated_invoicing |
Boolean | No |
Indicates whether invoices raised on the same day for the Note: Any invoices raised when a subscription activates from . |
entity_code |
String | No |
The exemption category of the customer, for USA and Canada. Applicable if you use Chargebee's AvaTax for Sales integration . * l - Other or custom * m - Educational organization * n - Local government * h - Commercial agricultural production * i - Industrial production/manufacturer * j - Direct pay permit * k - Direct mail * p - Commercial aquaculture * q - Commercial Fishery * r - Non-resident * d - Foreign diplomat * e - Charitable or benevolent organization * f - Religious organization * g - Resale * a - Federal government * b - State government * c - Tribe/Status Indian/Indian Band * med2 - US Medical Device Excise Tax with taxable sales tax * med1 - US Medical Device Excise Tax with exempt sales tax Valid values:
|
token_id |
String | No |
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 |
meta_data |
Object | No |
A collection of key-value pairs that provides extra information about the customer. **Note:** There's a character limit of 65,535. [Learn more](/docs/api/advanced-features) . |
payment_intent |
Object | No |
Parameters for payment_intent |
payment_intent.id |
String | No |
Identifier for the Prerequisites
|
payment_intent.gateway_account_id |
String | No |
The gateway account used for performing the 3DS flow. |
payment_intent.payment_method_type |
String | No |
The payment method type. Default value
card * dotpay -dotpay * faster_payments -Faster Payments * upi -upi * kbc_payment_button -KBC Payment Button * google_pay -google_pay * paypal_express_checkout -paypal_express_checkout * pix -Pix * klarna_pay_now -Klarna Pay Now * ideal -ideal * boleto -boleto * direct_debit -direct_debit * sepa_instant_transfer -Sepa Instant Transfer * bancontact -bancontact * trustly -Trustly * stablecoin -Stablecoin * venmo -Venmo * pay_to -PayTo * netbanking_emandates -netbanking_emandates * payconiq_by_bancontact -Payconiq by Bancontact * electronic_payment_standard -Electronic Payment Standard * pay_by_bank -Pay By Bank * apple_pay -apple_pay * online_banking_poland -Online Banking Poland * giropay -giropay * sofort -sofort * amazon_payments -Amazon Payments Valid values:
|
payment_intent.additional_information |
Object | No |
|
payment_intent.gw_token |
String | No |
Identifier for 3DS transaction/verification object at the gateway. Can be passed only after successfully completing the 3DS flow. Refer 3DS implementation in Chargebee to find out the gateway-specific gw_token format. Applicable when you are using gateway APIs directly for completing the 3DS flow. |
payment_intent.reference_id |
String | No |
Identifier for Braintree permanent token. Applicable when you are using Braintree APIs for completing the 3DS flow. |
exempt_number |
String | No |
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 . |
exemption_details[] |
Array | No |
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 . |
bank_account |
Object | No |
Parameters for bank_account |
bank_account.first_name |
String | No |
Account holder's first name as per bank account. If not passed, details from customer details will be considered. |
bank_account.swedish_identity_number |
String | No |
For GoCardless Autogiro users only. The civic/company number (personnummer, samordningsnummer, or organisationsnummer) of the customer. Must be supplied if the customer's bank account is denominated in Swedish krona (SEK). This field cannot be changed once it has been set. |
bank_account.iban |
String | No |
Account holder's International Bank Account Number. For the GoCardless platform, this can be the local bank details |
bank_account.account_number |
String | No |
Account holder's bank account number. |
bank_account.account_type |
String | No |
Represents the account type used to create a payment source. Available for Authorize.net ACH and Razorpay NetBanking users only. If not passed, account type is taken as null. * checking - Checking Account * business_checking - Business Checking Account * savings - Savings Account * current - Current Account Valid values:
|
bank_account.email |
String | No |
Account holder's email address. If not passed, details from customer details will be considered. All Direct Debit compliant emails will be sent to this email address. |
bank_account.last_name |
String | No |
Account holder's last name as per bank account. If not passed, details from customer details will be considered. |
bank_account.bank_code |
String | No |
Indicates the bank code. |
bank_account.company |
String | No |
Account holder's company name as per bank account. If not passed, details from customer details will be considered. |
bank_account.bank_name |
String | No |
Name of account holder's bank. |
bank_account.gateway_account_id |
String | No |
The gateway account in which this payment source is stored. Required when
|
bank_account.phone |
String | No |
Phone number of the account holder that is linked to the bank account. |
bank_account.routing_number |
String | No |
Bank account routing number. |
bank_account.issuing_country |
String | No |
two-letter(alpha2) ISO country code. Required when local bank details are provided, and not IBAN. |
bank_account.account_holder_type |
String | No |
For Stripe ACH users only. Indicates the account holder type. * individual - Individual Account. * company - Company Account. Valid values:
|
bank_account.echeck_type |
String | No |
For Authorize.net ACH users only. Indicates the type of eCheck. * ppd - Payment Authorization is prearranged between the customer and the merchant. * ccd - Payment Authorization agreement from the corporate customer is required. Applicable for business_checking account_type. * web - Payment Authorization obtained from the customer via the internet. Valid values:
|
bank_account.billing_address |
Object | No |
The billing address associated with the bank account. The value is a JSON object with the following keys and their values:-
|
card |
Object | No |
Parameters for card. Use this parameter to pass raw card details. Passing raw card data via API involves PCI liability at your end due to the sensitivity of the data. |
card.billing_addr2 |
String | No |
Address line 2, as available in card billing address. |
card.billing_addr1 |
String | No |
Address line 1, as available in card billing address. |
card.number |
String | No |
The 16 digit credit card number. |
card.first_name |
String | No |
Cardholder's first name |
card.expiry_month |
Integer | No |
Card expiry month. |
card.additional_information |
Object | No |
|
card.last_name |
String | No |
Cardholder's last name |
card.gateway_account_id |
String | No |
The gateway account in which these card details are stored. Required when
|
card.billing_state_code |
String | No |
The ISO 3166-2 state/province code
without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set |
card.billing_zip |
String | No |
Postal or Zip code, as available in card billing address. |
card.expiry_year |
Integer | No |
Card expiry year. |
card.cvv |
String | No |
The card verification value (CVV). If you are using Braintree.js , you can specify the Braintree encrypted CVV here. |
card.billing_city |
String | No |
City, as available in card billing address. |
card.billing_state |
String | No |
The state/province name. Is set by Chargebee automatically for US, Canada and India If |
card.preferred_scheme |
String | No |
The customer's preferred card scheme for co-branded cards. A Cartes Bancaires card scheme. * mastercard - A MasterCard scheme. * visa - A Visa card scheme. Valid values:
|
card.billing_country |
String | No |
The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code . Note: If you enter an invalid country code, the system will return an error. Brexit If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then |
auto_close_invoices |
Boolean | No |
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. |
allow_direct_debit |
Boolean | No |
Whether the customer can pay via Direct Debit. Default value: false |
business_customer_without_vat_number |
Boolean | No |
Confirms that a customer is a valid business without an EU/UK VAT number. |
client_profile_id |
String | No |
Indicates the Client profile id for the customer. This is applicable only if you use Chargebee's AvaTax for Communications integration. |
offline_payment_method |
String | No |
The preferred offline payment method for the customer. Constraints
Prerequisites
SEPA Credit * cash -Cash * no_preference -No Preference * bank_transfer -Bank Transfer * check -Check * eu_automated_bank_transfer -EU Automated Bank Transfer * jp_automated_bank_transfer -JP Automated Bank Transfer * uk_automated_bank_transfer -UK Automated Bank Transfer * custom -Custom * boleto -Boleto * mx_automated_bank_transfer -MX Automated Bank Transfer * us_automated_bank_transfer -US Automated Bank Transfer * ach_credit -ACH Credit Valid values:
|
last_name |
String | No |
Last name of the customer. |
vat_number_prefix |
String | No |
An overridden value for the first two characters of the full VAT number.
Only applicable specifically for customers with
When you have enabled EU VAT
in 2021 or have manually enabled
the Brexit configuration, you have the option of setting
|
phone |
String | No |
Phone number of the customer. |
entity_identifier_standard |
String | No |
The standard used for specifying the Tip: If there are additional entity identifiers for the customer not associated with the Default value: "iso6523-actorid-upis" |
einvoicing_method |
String | No |
Determines whether to send an e-invoice manually or automatic. * 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. Valid values:
|
registered_for_gst |
Boolean | No |
Confirms that a customer is registered under GST. If set to |
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.