# Create a customer

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Idempotency Supported](/docs/api/idempotency)

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](/docs/api/payment_sources), it is recommended to use one of the [Payment Source APIs](/docs/api/payment_sources) 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[](#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](/docs/api/advanced-features) defined for the site.

**

#### Invoices[](#invoices)

**

-   Chargebee uses the `billing_address` object from the customer to set the values in the [`billing_address`](/docs/api/invoices/invoice-object#billing_address) of the invoices generated for the customer.
-   If the `billing_address` object does not include the `first_name`, `last_name`, or `company` fields, Chargebee automatically uses the values from [`customer.first_name`](/docs/api/customers/customer-object#first_name), [`customer.last_name`](/docs/api/customers/customer-object#last_name), and [`customer.company`](/docs/api/customers/customer-object#company) (if available) when generating invoices.

**

#### Payment source[](#payment-source)

**

-   If `payment_intent` or `payment_method` parameter is passed, a `payment_source` resource of the appropriate type is created for the customer.
-   If `bank_account` parameter is passed, a `payment_source` resource of `type` `direct_debit` is created for the customer.
-   If `card` parameter is passed, a `payment_source` resource of `type` `card` is created for the customer.

**

##### Integrations[](#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`[](#create-payment-source-using-paymentintent)

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](https://www.chargebee.com/docs/payments/2.0/others/psd2-sca) (SCA) (i.e. 3D-Secure) and non-SCA flows.

1.  Create a `payment_intent` resource by calling the [Create a payment intent API](/docs/api/payment_intents/create-a-payment-intent).
2.  Pass the `payment_intent` object to your frontend and use Chargebee.js to capture the payment source details from the customer. Use [Payment Components](https://www.chargebee.com/docs/payments/2.0/payment-components/overview) to show payment method UIs and collect payment method details from the customer.
3.  Listen to the [`payment_intent_updated`](/docs/api/events#payment_intent_updated) event. Once the `payment_intent.status` is `authorized`, pass the `payment_intent.id` using the `payment_intent[id]` parameter in this API call.

#### Create payment source using `payment_method`[](#create-payment-source-using-paymentmethod)

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.

1.  Use the JavaScript library of your payment gateway to capture the payment method details. Examples include:

-   [Stripe.js](https://stripe.com/docs/js)
-   [Braintree.js](https://developer.paypal.com/braintree/docs/guides/client-sdk/setup/javascript/v2)
-   [Accept.js](https://developer.authorize.net/api/reference/features/acceptjs.html) (if you use [Authorize.Net](https://developer.authorize.net/api/reference/features/acceptjs.html))
-   Adyen's [Client-Side Encryption](https://docs.adyen.com/online-payments/classic-integrations/api-integration-ecommerce/cse-integration-ecommerce) (if you use Adyen)

1.  Pass the payment method token using the `payment_method[reference_id]` or `payment_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`[](#create-payment-source-using-bankaccount)

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`[](#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.

#### Related APIs

Update a customer

Update billing info for a customer

## Sample Request

### creates a customer with billing address.

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/customers \
     -u {site_api_key}:\
     -d first_name="John" \
     -d last_name="Doe" \
     -d email="john@test.com" \
     -d locale="fr-CA" \
     -d "billing_address[first_name]"="John" \
     -d "billing_address[last_name]"="Doe" \
     -d "billing_address[line1]"="PO Box 9999" \
     -d "billing_address[city]"="Walnut" \
     -d "billing_address[state]"="California" \
     -d "billing_address[zip]"="91789" \
     -d "billing_address[country]"="US"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Customer.Create()
		.FirstName("John")
		.LastName("Doe")
		.Email("john@test.com")
		.Locale("fr-CA")
		.BillingAddressFirstName("John")
		.BillingAddressLastName("Doe")
		.BillingAddressLine1("PO Box 9999")
		.BillingAddressCity("Walnut")
		.BillingAddressState("California")
		.BillingAddressZip("91789")
		.BillingAddressCountry("US")
		.Request();

Customer customer = result.Customer;
Card card = result.Card;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    customerAction "github.com/chargebee/chargebee-go/v3/actions/customer"
    "github.com/chargebee/chargebee-go/v3/models/customer"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := customerAction.Create(&customer.CreateRequestParams{
        FirstName : "John",
        LastName : "Doe",
        Email : "john@test.com",
        Locale : "fr-CA",
        BillingAddress : &customer.CreateBillingAddressParams{
            FirstName : "John",
            LastName : "Doe",
            Line1 : "PO Box 9999",
            City : "Walnut",
            State : "California",
            Zip : "91789",
            Country : "US",
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
        Card := res.Card
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.CustomerCreateRequest{
    FirstName : "John",
    LastName : "Doe",
    Email : "john@test.com",
    Locale : "fr-CA",
    BillingAddress : &chargebee.CustomerCreateBillingAddress{
        FirstName : "John",
        LastName : "Doe",
        Line1 : "PO Box 9999",
        City : "Walnut",
        State : "California",
        Zip : "91789",
        Country : "US",
    },
}
  res, err := client.Customer.Create(req)
      if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
        Card := res.Card
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Customer.create()
            .firstName("John")
            .lastName("Doe")
            .email("john@test.com")
            .locale("fr-CA")
            .billingAddressFirstName("John")
            .billingAddressLastName("Doe")
            .billingAddressLine1("PO Box 9999")
            .billingAddressCity("Walnut")
            .billingAddressState("California")
            .billingAddressZip("91789")
            .billingAddressCountry("US")
            .request();

        Customer customer = result.customer();
        Card card = result.card();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.card.Card;
import com.chargebee.v4.models.customer.Customer;
import com.chargebee.v4.models.customer.params.CustomerCreateParams;
import com.chargebee.v4.models.customer.responses.CustomerCreateResponse;

public class CustomerCreate {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        CustomerCreateParams.BillingAddressParams billingAddressParams =
            CustomerCreateParams.BillingAddressParams.builder()
                .firstName("John")
                .lastName("Doe")
                .line1("PO Box 9999")
                .city("Walnut")
                .state("California")
                .zip("91789")
                .country("US")
                .build();

        CustomerCreateParams params = CustomerCreateParams.builder()
            .firstName("John")
            .lastName("Doe")
            .email("john@test.com")
            .locale("fr-CA")
            .billingAddress(billingAddressParams)
            .build();

        CustomerCreateResponse response = client.customers().create(params);

        Customer customer = response.getCustomer();
        Card card = response.getCard();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.customer.create({
        first_name: "John",
        last_name: "Doe",
        email: "john@test.com",
        locale: "fr-CA",
        billing_address: {
            first_name: "John",
            last_name: "Doe",
            line1: "PO Box 9999",
            city: "Walnut",
            state: "California",
            zip: 91789,
            country: "US"
        }
    });

    console.log(result);
    const customer = result.customer;
    const card = result.card;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->customer()->create([
    "first_name" => "John",
    "last_name" => "Doe",
    "email" => "john@test.com",
    "locale" => "fr-CA",
    "billing_address" => [
        "first_name" => "John",
        "last_name" => "Doe",
        "line1" => "PO Box 9999",
        "city" => "Walnut",
        "state" => "California",
        "zip" => "91789",
        "country" => "US"
    ]
]);
$customer = $result->customer;
$card = $result->card;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Customer.create(
    cb_client.Customer.CreateParams(
        first_name="John",
        last_name="Doe",
        email="john@test.com",
        locale="fr-CA",
        billing_address=cb_client.Customer.CreateBillingAddressParams(
            first_name="John",
            last_name="Doe",
            line1="PO Box 9999",
            city="Walnut",
            state="California",
            zip="91789",
            country="US"
        )
    )
)
customer = response.customer
card = response.card
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::Customer.create({
  :first_name => "John",
  :last_name => "Doe",
  :email => "john@test.com",
  :locale => "fr-CA",
  :billing_address => {
    :first_name => "John",
    :last_name => "Doe",
    :line1 => "PO Box 9999",
    :city => "Walnut",
    :state => "California",
    :zip => "91789",
    :country => "US"
  }
})

customer = result.customer
card = result.card
```

### creates a customer with bank account.

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/customers \
     -u {site_api_key}:\
     -d first_name="John" \
     -d last_name="Doe" \
     -d allow_direct_debit="true" \
     -d email="john@test.com" \
     -d "bank_account[account_number]"="000222222227" \
     -d "bank_account[routing_number]"="110000000" \
     -d "bank_account[bank_name]"="US Bank" \
     -d "bank_account[account_holder_type]"="INDIVIDUAL" \
     -d "bank_account[account_type]"="SAVINGS" \
     -d "bank_account[first_name]"="Shay" \
     -d "bank_account[last_name]"="Liam" \
     -d "bank_account[gateway_account_id]"="gw___test__KyVnGlSBWl8M41ju"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;
using ChargeBee.Models.Enums;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Customer.Create()
		.FirstName("John")
		.LastName("Doe")
		.AllowDirectDebit(true)
		.Email("john@test.com")
		.BankAccountAccountNumber("000222222227")
		.BankAccountRoutingNumber("110000000")
		.BankAccountBankName("US Bank")
		.BankAccountAccountHolderType(AccountHolderTypeEnum.Individual)
		.BankAccountAccountType(AccountTypeEnum.Savings)
		.BankAccountFirstName("Shay")
		.BankAccountLastName("Liam")
		.BankAccountGatewayAccountId("gw___test__KyVnGlSBWl8M41ju")
		.Request();

Customer customer = result.Customer;
Card card = result.Card;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    customerAction "github.com/chargebee/chargebee-go/v3/actions/customer"
    "github.com/chargebee/chargebee-go/v3/models/customer"
    enum "github.com/chargebee/chargebee-go/v3/enum"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := customerAction.Create(&customer.CreateRequestParams{
        FirstName : "John",
        LastName : "Doe",
        AllowDirectDebit : chargebee.Bool(true),
        Email : "john@test.com",
        BankAccount : &customer.CreateBankAccountParams{
            AccountNumber : "000222222227",
            RoutingNumber : "110000000",
            BankName : "US Bank",
            AccountHolderType : enum.AccountHolderTypeIndividual,
            AccountType : enum.AccountTypeSavings,
            FirstName : "Shay",
            LastName : "Liam",
            GatewayAccountId : "gw___test__KyVnGlSBWl8M41ju",
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
        Card := res.Card
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.CustomerCreateRequest{
    FirstName : "John",
    LastName : "Doe",
    AllowDirectDebit : chargebee.Bool(true),
    Email : "john@test.com",
    BankAccount : &chargebee.CustomerCreateBankAccount{
        AccountNumber : "000222222227",
        RoutingNumber : "110000000",
        BankName : "US Bank",
        AccountHolderType : chargebee.AccountHolderTypeIndividual,
        AccountType : chargebee.AccountTypeSavings,
        FirstName : "Shay",
        LastName : "Liam",
        GatewayAccountId : "gw___test__KyVnGlSBWl8M41ju",
    },
}
  res, err := client.Customer.Create(req)
      if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
        Card := res.Card
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Customer.create()
            .firstName("John")
            .lastName("Doe")
            .allowDirectDebit(true)
            .email("john@test.com")
            .bankAccountAccountNumber("000222222227")
            .bankAccountRoutingNumber("110000000")
            .bankAccountBankName("US Bank")
            .bankAccountAccountHolderType(AccountHolderType.INDIVIDUAL)
            .bankAccountAccountType(AccountType.SAVINGS)
            .bankAccountFirstName("Shay")
            .bankAccountLastName("Liam")
            .bankAccountGatewayAccountId("gw___test__KyVnGlSBWl8M41ju")
            .request();

        Customer customer = result.customer();
        Card card = result.card();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.card.Card;
import com.chargebee.v4.models.customer.Customer;
import com.chargebee.v4.models.customer.params.CustomerCreateParams;
import com.chargebee.v4.models.customer.responses.CustomerCreateResponse;

public class CustomerCreate {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        CustomerCreateParams.BankAccountParams bankAccountParams =
            CustomerCreateParams.BankAccountParams.builder()
                .accountNumber("000222222227")
                .routingNumber("110000000")
                .bankName("US Bank")
                .accountHolderType(CustomerCreateParams.BankAccountParams.AccountHolderType.INDIVIDUAL)
                .accountType(CustomerCreateParams.BankAccountParams.AccountType.SAVINGS)
                .firstName("Shay")
                .lastName("Liam")
                .gatewayAccountId("gw___test__KyVnGlSBWl8M41ju")
                .build();

        CustomerCreateParams params = CustomerCreateParams.builder()
            .firstName("John")
            .lastName("Doe")
            .allowDirectDebit(true)
            .email("john@test.com")
            .bankAccount(bankAccountParams)
            .build();

        CustomerCreateResponse response = client.customers().create(params);

        Customer customer = response.getCustomer();
        Card card = response.getCard();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.customer.create({
        first_name: "John",
        last_name: "Doe",
        allow_direct_debit: true,
        email: "john@test.com",
        bank_account: {
            account_number: "000222222227",
            routing_number: 110000000,
            bank_name: "US Bank",
            account_holder_type: "individual",
            account_type: "savings",
            first_name: "Shay",
            last_name: "Liam",
            gateway_account_id: "gw___test__KyVnGlSBWl8M41ju"
        }
    });

    console.log(result);
    const customer = result.customer;
    const card = result.card;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->customer()->create([
    "first_name" => "John",
    "last_name" => "Doe",
    "allow_direct_debit" => true,
    "email" => "john@test.com",
    "bank_account" => [
        "account_number" => "000222222227",
        "routing_number" => "110000000",
        "bank_name" => "US Bank",
        "account_holder_type" => "individual",
        "account_type" => "savings",
        "first_name" => "Shay",
        "last_name" => "Liam",
        "gateway_account_id" => "gw___test__KyVnGlSBWl8M41ju"
    ]
]);
$customer = $result->customer;
$card = $result->card;
```

#### Python

```python
import chargebee
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Customer.create(
    cb_client.Customer.CreateParams(
        first_name="John",
        last_name="Doe",
        allow_direct_debit=True,
        email="john@test.com",
        bank_account=cb_client.Customer.CreateBankAccountParams(
            account_number="000222222227",
            routing_number="110000000",
            bank_name="US Bank",
            account_holder_type=chargebee.AccountHolderType.INDIVIDUAL,
            account_type=chargebee.AccountType.SAVINGS,
            first_name="Shay",
            last_name="Liam",
            gateway_account_id="gw___test__KyVnGlSBWl8M41ju"
        )
    )
)
customer = response.customer
card = response.card
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::Customer.create({
  :first_name => "John",
  :last_name => "Doe",
  :allow_direct_debit => "true",
  :email => "john@test.com",
  :bank_account => {
    :account_number => "000222222227",
    :routing_number => "110000000",
    :bank_name => "US Bank",
    :account_holder_type => "INDIVIDUAL",
    :account_type => "SAVINGS",
    :first_name => "Shay",
    :last_name => "Liam",
    :gateway_account_id => "gw___test__KyVnGlSBWl8M41ju"
  }
})

customer = result.customer
card = result.card
```

### creates a customer with card details.

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/customers \
     -u {site_api_key}:\
     -d first_name="John" \
     -d last_name="Doe" \
     -d email="john@test.com" \
     -d "card[first_name]"="Richard" \
     -d "card[last_name]"="Fox" \
     -d "card[number]"="4012888888881881" \
     -d "card[expiry_month]"=10 \
     -d "card[expiry_year]"=2022 \
     -d "card[cvv]"="999"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Customer.Create()
		.FirstName("John")
		.LastName("Doe")
		.Email("john@test.com")
		.CardFirstName("Richard")
		.CardLastName("Fox")
		.CardNumber("4012888888881881")
		.CardExpiryMonth(10)
		.CardExpiryYear(2022)
		.CardCvv("999")
		.Request();

Customer customer = result.Customer;
Card card = result.Card;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    customerAction "github.com/chargebee/chargebee-go/v3/actions/customer"
    "github.com/chargebee/chargebee-go/v3/models/customer"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := customerAction.Create(&customer.CreateRequestParams{
        FirstName : "John",
        LastName : "Doe",
        Email : "john@test.com",
        Card : &customer.CreateCardParams{
            FirstName : "Richard",
            LastName : "Fox",
            Number : "4012888888881881",
            ExpiryMonth : chargebee.Int32(10),
            ExpiryYear : chargebee.Int32(2022),
            Cvv : "999",
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
        Card := res.Card
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.CustomerCreateRequest{
    FirstName : "John",
    LastName : "Doe",
    Email : "john@test.com",
    Card : &chargebee.CustomerCreateCard{
        FirstName : "Richard",
        LastName : "Fox",
        Number : "4012888888881881",
        ExpiryMonth : chargebee.Int32(10),
        ExpiryYear : chargebee.Int32(2022),
        Cvv : "999",
    },
}
  res, err := client.Customer.Create(req)
      if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
        Card := res.Card
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Customer.create()
            .firstName("John")
            .lastName("Doe")
            .email("john@test.com")
            .cardFirstName("Richard")
            .cardLastName("Fox")
            .cardNumber("4012888888881881")
            .cardExpiryMonth(10)
            .cardExpiryYear(2022)
            .cardCvv("999")
            .request();

        Customer customer = result.customer();
        Card card = result.card();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.card.Card;
import com.chargebee.v4.models.customer.Customer;
import com.chargebee.v4.models.customer.params.CustomerCreateParams;
import com.chargebee.v4.models.customer.responses.CustomerCreateResponse;

public class CustomerCreate {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        CustomerCreateParams.CardParams cardParams =
            CustomerCreateParams.CardParams.builder()
                .firstName("Richard")
                .lastName("Fox")
                .number("4012888888881881")
                .expiryMonth(10)
                .expiryYear(2022)
                .cvv("999")
                .build();

        CustomerCreateParams params = CustomerCreateParams.builder()
            .firstName("John")
            .lastName("Doe")
            .email("john@test.com")
            .card(cardParams)
            .build();

        CustomerCreateResponse response = client.customers().create(params);

        Customer customer = response.getCustomer();
        Card card = response.getCard();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.customer.create({
        first_name: "John",
        last_name: "Doe",
        email: "john@test.com",
        card: {
            first_name: "Richard",
            last_name: "Fox",
            number: 4012888888881881,
            expiry_month: 10,
            expiry_year: 2022,
            cvv: 999
        }
    });

    console.log(result);
    const customer = result.customer;
    const card = result.card;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->customer()->create([
    "first_name" => "John",
    "last_name" => "Doe",
    "email" => "john@test.com",
    "card" => [
        "first_name" => "Richard",
        "last_name" => "Fox",
        "number" => "4012888888881881",
        "expiry_month" => 10,
        "expiry_year" => 2022,
        "cvv" => "999"
    ]
]);
$customer = $result->customer;
$card = $result->card;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Customer.create(
    cb_client.Customer.CreateParams(
        first_name="John",
        last_name="Doe",
        email="john@test.com",
        card=cb_client.Customer.CreateCardParams(
            first_name="Richard",
            last_name="Fox",
            number="4012888888881881",
            expiry_month=10,
            expiry_year=2022,
            cvv="999"
        )
    )
)
customer = response.customer
card = response.card
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::Customer.create({
  :first_name => "John",
  :last_name => "Doe",
  :email => "john@test.com",
  :card => {
    :first_name => "Richard",
    :last_name => "Fox",
    :number => "4012888888881881",
    :expiry_month => 10,
    :expiry_year => 2022,
    :cvv => "999"
  }
})

customer = result.customer
card = result.card
```

### creates a customer with payment source.

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/customers \
     -u {site_api_key}:\
     -d first_name="John" \
     -d last_name="Doe" \
     -d "payment_method[gateway_account_id]"="gw___test__KyVnGlSBWl8M41ju" \
     -d "payment_method[type]"="CARD" \
     -d "payment_method[reference_id]"="cus_I58PkwpAskxXlJ"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;
using ChargeBee.Models.Enums;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Customer.Create()
		.FirstName("John")
		.LastName("Doe")
		.PaymentMethodGatewayAccountId("gw___test__KyVnGlSBWl8M41ju")
		.PaymentMethodType(TypeEnum.Card)
		.PaymentMethodReferenceId("cus_I58PkwpAskxXlJ")
		.Request();

Customer customer = result.Customer;
Card card = result.Card;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    customerAction "github.com/chargebee/chargebee-go/v3/actions/customer"
    "github.com/chargebee/chargebee-go/v3/models/customer"
    enum "github.com/chargebee/chargebee-go/v3/enum"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := customerAction.Create(&customer.CreateRequestParams{
        FirstName : "John",
        LastName : "Doe",
        PaymentMethod : &customer.CreatePaymentMethodParams{
            GatewayAccountId : "gw___test__KyVnGlSBWl8M41ju",
            Type : enum.TypeCard,
            ReferenceId : "cus_I58PkwpAskxXlJ",
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
        Card := res.Card
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.CustomerCreateRequest{
    FirstName : "John",
    LastName : "Doe",
    PaymentMethod : &chargebee.CustomerCreatePaymentMethod{
        GatewayAccountId : "gw___test__KyVnGlSBWl8M41ju",
        Type : chargebee.TypeCard,
        ReferenceId : "cus_I58PkwpAskxXlJ",
    },
}
  res, err := client.Customer.Create(req)
      if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
        Card := res.Card
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Customer.create()
            .firstName("John")
            .lastName("Doe")
            .paymentMethodGatewayAccountId("gw___test__KyVnGlSBWl8M41ju")
            .paymentMethodType(Type.CARD)
            .paymentMethodReferenceId("cus_I58PkwpAskxXlJ")
            .request();

        Customer customer = result.customer();
        Card card = result.card();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.card.Card;
import com.chargebee.v4.models.customer.Customer;
import com.chargebee.v4.models.customer.params.CustomerCreateParams;
import com.chargebee.v4.models.customer.responses.CustomerCreateResponse;

public class CustomerCreate {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        CustomerCreateParams.PaymentMethodParams paymentMethodParams =
            CustomerCreateParams.PaymentMethodParams.builder()
                .gatewayAccountId("gw___test__KyVnGlSBWl8M41ju")
                .type(CustomerCreateParams.PaymentMethodParams.Type.CARD)
                .referenceId("cus_I58PkwpAskxXlJ")
                .build();

        CustomerCreateParams params = CustomerCreateParams.builder()
            .firstName("John")
            .lastName("Doe")
            .paymentMethod(paymentMethodParams)
            .build();

        CustomerCreateResponse response = client.customers().create(params);

        Customer customer = response.getCustomer();
        Card card = response.getCard();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.customer.create({
        first_name: "John",
        last_name: "Doe",
        payment_method: {
            gateway_account_id: "gw___test__KyVnGlSBWl8M41ju",
            type: "card",
            reference_id: "cus_I58PkwpAskxXlJ"
        }
    });

    console.log(result);
    const customer = result.customer;
    const card = result.card;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->customer()->create([
    "first_name" => "John",
    "last_name" => "Doe",
    "payment_method" => [
        "gateway_account_id" => "gw___test__KyVnGlSBWl8M41ju",
        "type" => "card",
        "reference_id" => "cus_I58PkwpAskxXlJ"
    ]
]);
$customer = $result->customer;
$card = $result->card;
```

#### Python

```python
import chargebee
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Customer.create(
    cb_client.Customer.CreateParams(
        first_name="John",
        last_name="Doe",
        payment_method=cb_client.Customer.CreatePaymentMethodParams(
            gateway_account_id="gw___test__KyVnGlSBWl8M41ju",
            type=chargebee.Type.CARD,
            reference_id="cus_I58PkwpAskxXlJ"
        )
    )
)
customer = response.customer
card = response.card
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::Customer.create({
  :first_name => "John",
  :last_name => "Doe",
  :payment_method => {
    :gateway_account_id => "gw___test__KyVnGlSBWl8M41ju",
    :type => "CARD",
    :reference_id => "cus_I58PkwpAskxXlJ"
  }
})

customer = result.customer
card = result.card
```

## Sample Response

```json
{
  "customer": {
    "allow_direct_debit": false,
    "auto_collection": "on",
    "billing_address": {
      "city": "Walnut",
      "country": "US",
      "first_name": "John",
      "last_name": "Doe",
      "line1": "PO Box 9999",
      "object": "billing_address",
      "state": "California",
      "state_code": "CA",
      "validation_status": "not_validated",
      "zip": "91789"
    },
    "card_status": "no_card",
    "created_at": 1517505731,
    "deleted": false,
    "email": "john@test.com",
    "excess_payments": 0,
    "first_name": "John",
    "id": "__test__KyVnHhSBWl7eY2bl",
    "last_name": "Doe",
    "locale": "fr-CA",
    "net_term_days": 0,
    "object": "customer",
    "pii_cleared": "active",
    "preferred_currency_code": "USD",
    "promotional_credits": 0,
    "refundable_credits": 0,
    "resource_version": 1517505731000,
    "taxability": "taxable",
    "unbilled_charges": 0,
    "updated_at": 1517505731
  }
}
```

## 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 address of the customer. Configured email notifications are sent to this email address. Invalid email address will result in an error.

- `preferred_currency_code` (optional, string, max chars=3)
  The currency code (in [ISO 4217 format](https://www.iso.org/iso-4217-currency-codes.html)) of the customer.

- `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 from [`invoice.date`](/docs/api/invoices/invoice-object#date) until payment for the invoice is due.

- `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](/docs/api/customers/customer-object#billing_address)`
  
  `country` as `XI` (which is **United Kingdom - Northern Ireland** ), the first two characters of the [full VAT number](https://en.wikipedia.org/wiki/VAT_identification_number) can be overridden by setting `[vat_number_prefix](/docs/api/customers/customer-object#vat_number_prefix)` .

- `vat_number_prefix` (optional, string, max chars=10)
  An overridden value for the first two characters of the [full VAT number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with `[billing_address](/docs/api/customers/customer-object#billing_address)`
  
  `country` as `XI` (which is **United Kingdom - Northern Ireland** ).
  
  When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting `[billing_address](/docs/api/customers/customer-object#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](/docs/api/customers/customer-object#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](https://www.chargebee.com/docs/e-invoicing.html#supported-countries) .
  
  **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](https://www.chargebee.com/docs/australian-gst.html#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 an e-invoice 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](https://www.chargebee.com/docs/tax.html). 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](https://www.chargebee.com/docs/tax.html) feature or when using the [TaxJar integration](https://www.chargebee.com/docs/taxjar.html), no other action is needed.
      -   However, when using our [Avalara integration](https://www.chargebee.com/docs/avalara.html), optionally, specify `entity_code` or `exempt_number` attributes if you use Chargebee's [AvaTax for Sales](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption) or specify `exemption_details` attribute if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) 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](https://www.chargebee.com/docs/avatax-for-communication.html) integration. To know more about what values you need to provide, refer to this [Avalara's API document](https://developer.avalara.com/communications/dev-guide_rest_v2/customizing-transactions/sample-transactions/exemption/) .

- `customer_type` (optional, enumerated string)
  Indicates the type of the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) 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](https://www.chargebee.com/docs/avatax-for-communication.html) 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. Use the [language pack](https://www.chargebee.com/docs/billing/2.0/customers/configure-multiple-languages#step-2-download-the-language-pack-and-provide-the-translations) to customize the translations for each locale.
  
  **Default behavior**
  
  -   If you don't pass `locale`, or if you pass it but it is not added and activated in Chargebee, then the [primary language](https://www.chargebee.com/docs/billing/2.0/customers/configure-multiple-languages#primary-language-of-your-chargebee-site) for customers would be used.

- `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](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption) .
  Possible enum values:
    - `a`
      Federal government
    - `b`
      State government
    - `c`
      Tribe/Status Indian/Indian Band
    - `d`
      Foreign diplomat
    - `e`
      Charitable or benevolent organization
    - `f`
      Religious organization
    - `g`
      Resale
    - `h`
      Commercial agricultural production
    - `i`
      Industrial production/manufacturer
    - `j`
      Direct pay permit
    - `k`
      Direct mail
    - `l`
      Other or custom
    - `m`
      Educational organization
    - `n`
      Local government
    - `p`
      Commercial aquaculture
    - `q`
      Commercial Fishery
    - `r`
      Non-resident
    - `med1`
      US Medical Device Excise Tax with exempt sales tax
    - `med2`
      US Medical Device Excise Tax with taxable sales tax

- `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](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption) .

- `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](/docs/api/advanced-features) .

- `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
    - `sepa_credit`
      SEPA Credit
    - `boleto`
      Boleto
    - `us_automated_bank_transfer`
      US Automated Bank Transfer
    - `eu_automated_bank_transfer`
      EU Automated Bank Transfer
    - `uk_automated_bank_transfer`
      UK Automated Bank Transfer
    - `jp_automated_bank_transfer`
      JP Automated Bank Transfer
    - `mx_automated_bank_transfer`
      MX Automated Bank Transfer
    - `custom`
      Custom

- `auto_close_invoices` (optional, boolean)
  Override for this customer, the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) 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](/docs/api/subscriptions/subscription-object#auto_close_invoices) 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](https://www.chargebee.com/docs/consolidated-invoicing.html#configuring-consolidated-invoicing). This parameter can be provided only when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html) is enabled.
  
  **Note:**
  
  Any invoices raised when a subscription activates from `in_trial` or `future` `status`, are not consolidated by default. [Contact Support](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&utm_medium=content&utm_campaign=support) to enable consolidation for such invoices.
  
  .

- `token_id` (optional, string, max chars=40)
  The Chargebee payment token generated by [Chargebee.js](https://www.chargebee.com/docs/payments/2.0/card-components-and-helpers/3ds-helper#using-the-gateways-hosted-fields).
  
  **Note**: The payment token created via Chargebee.js uses the gateway selected through [Smart Routing](https://www.chargebee.com/docs/payments/1.0/payment-gateways-and-configuration/gateway_settings#smart-routing). Explicitly passing a `gateway_id` in this API call will not override the gateway associated with the token.

- `business_entity_id` (optional, string, max chars=50)
  The unique ID of the [business entity](/docs/api/advanced-features) this customer should be [linked](/docs/api/advanced-features) to. An alternative way of passing this parameter is by means of a [custom HTTP header](/docs/api/advanced-features).
  
  **Default behavior**
  
  -   When not provided, the customer is linked to the [default business entity](/docs/api/advanced-features) defined for the site.

- `brand_id` (optional, string, max chars=50)
  The unique ID of the [brand](/docs/api/brands) this customer should be linked to. Applicable only when multiple brands have been created for the site. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand.
  
  **Default behavior**
  
  -   When not provided, the customer is linked to the default brand defined for the site.

- `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](/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF.

- `card` (optional, string)
  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.
  - `gateway_account_id` (optional, string, max chars=50)
    The gateway account in which these card details are stored.
    
    **Required when**
    
    -   All of the following conditions are met together:
    -   Passing `card` parameter.
    -   There are multiple [payment gateway](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings) accounts configured for the site.
    -   [Smart Routing](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings#smart-routing) is not configured for card payments.
  - `first_name` (optional, string, max chars=50)
    Cardholder's first name
  - `last_name` (optional, string, max chars=50)
    Cardholder's last name
  - `number` (required if card provided, string, max chars=1500)
    The 16 digit credit card number.
    
    If you are using [Braintree.js](https://developer.paypal.com/braintree/docs/guides/client-sdk/setup/javascript/v2#getting-braintree.js), you can specify the Braintree encrypted card number here.
  - `expiry_month` (required if card provided, integer, min=1, max=12)
    Card expiry month.
  - `expiry_year` (required if card provided, integer)
    Card expiry year.
  - `cvv` (optional, string, max chars=520)
    The card verification value (CVV). If you are using [Braintree.js](https://developer.paypal.com/braintree/docs/guides/client-sdk/setup/javascript/v2#getting-braintree.js) , you can specify the Braintree encrypted CVV here.
  - `preferred_scheme` (optional, enumerated string)
    The customer's preferred card scheme for co-branded cards.
    
    **Note**: Currently, this parameter is only supported for Stripe.
    Possible enum values:
      - `cartes_bancaires`
        A Cartes Bancaires card scheme.
      - `mastercard`
        A MasterCard scheme.
      - `visa`
        A Visa card scheme.
  - `billing_addr1` (optional, string, max chars=150)
    Address line 1, as available in card billing address.
  - `billing_addr2` (optional, string, max chars=150)
    Address line 2, as available in card billing address.
  - `billing_city` (optional, string, max chars=50)
    City, as available in card billing address.
  - `billing_state_code` (optional, string, max chars=50)
    The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada, India and UAE. For instance, for Arizona (USA), set `billing_state_code` as `AZ` (not `US-AZ` ). For Tamil Nadu (India), set as `TN` (not `IN-TN` ). For British Columbia (Canada), set as `BC` (not `CA-BC` ). For Dubai (UAE), set as `DU` (not `AE-DU` ).
  - `billing_state` (optional, string, max chars=50)
    The state/province name. Is set by Chargebee automatically for US, Canada, India and UAE, if `billing_state_code` is provided.
  - `billing_zip` (optional, string, max chars=20)
    Postal or Zip code, as available in card billing address.
  - `billing_country` (optional, string, max chars=50)
    The billing address country of the customer. Must be one of [ISO 3166 alpha-2 country code](https://www.iso.org/iso-3166-country-codes.html) .
    
    **Note**: If you enter an invalid country code, the system will return an error.
    
    **Brexit**
    
    If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or later, or have [manually enable](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, then `XI` (the code for **United Kingdom - Northern Ireland**) is available as an option.
  - `additional_information` (optional, jsonobject)
    -   `checkout_com`: While adding a new payment method using [permanent token](/docs/api/payment_sources/create-using-permanent-token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://www.checkout.com/docs/previous/payments/payment-methods/cards/dlocal).
        
        -   `payer`: User related information.
            -   `country_of_residence`: This is required since the billing country associated with the user's payment method may not be the same as their country of residence. Hence the user's country of residence needs to be specified. The country code should be a [two-character ISO code](https://docs.checkout.com/resources/codes/country-codes).
            -   `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country.
    -   `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) required to perform anti-fraud validation.
    -   `braintree`: While passing raw card details to Braintree, your `fraud_merchant_id` and the user's `device_session_id` can be added to perform [additional validation](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) and avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `device_session_id`: Session ID associated with the user's device.
            -   `fraud_merchant_id`: Your [merchant ID](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) for fraud detection.
    -   `chargebee_payments`: While passing raw card details to Chargebee Payments, if `fraud_session_id` is added, additional validation is performed to avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `fraud_session_id`: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.
    -   `bank_of_america`: While passing raw card details to Bank of America, your user's `device_session_id` can be added to perform additional validation and avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `device_session_id`: Session ID associated with the user's device.
    -   `ecentric`: This parameter is used to verify and process payment method details in Ecentric. If the `merchant_id` parameter is included, Chargebee will vault it / perform a lookup and verification against this `merchant_id`, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part.
        
        -   `merchant_id`: Merchant GUID where the card is vaulted or need to be vaulted.
    -   `ebanx`: While passing raw card details to EBANX, the user's `document` is required for some countries and `device_session_id` can be added to perform [additional validation](https://developer.ebanx.com/docs/payments/guides/features/device-fingerprint#device-fingerprint) and avoid fraudulent transactions.
        
        -   `payer`: User related information.
            -   `document`: Document is the user's identification number based on their country.
        -   `fraud`: Fraud identification related information.
            -   `device_session_id`: Session ID associated with the user's device

- `bank_account` (optional, string)
  Parameters for bank\_account
  - `gateway_account_id` (optional, string, max chars=50)
    The gateway account in which this payment source is stored.
    
    **Required when**
    
    -   All of the following conditions are met together:
    -   Passing `bank_account` parameter.
    -   There are multiple [payment gateway](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings) accounts configured for the site.
    -   [Smart Routing](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings#smart-routing) is not configured for bank account payments.
  - `iban` (optional, string, min chars=10, max chars=50)
    Account holder's International Bank Account Number. For the [GoCardless](https://www.chargebee.com/docs/gocardless.html) platform, this can be the [local bank details](https://developer.gocardless.com/api-reference/#appendix-local-bank-details)
  - `first_name` (optional, string, max chars=150)
    Account holder's first name as per bank account. If not passed, details from customer details will be considered.
  - `last_name` (optional, string, max chars=150)
    Account holder's last name as per bank account. If not passed, details from customer details will be considered.
  - `company` (optional, string, max chars=250)
    Account holder's company name as per bank account. If not passed, details from customer details will be considered.
  - `email` (optional, string, max chars=70)
    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.
  - `phone` (optional, string, max chars=50)
    Phone number of the account holder that is linked to the bank account.
  - `bank_name` (optional, string, max chars=100)
    Name of account holder's bank.
  - `account_number` (optional, string, min chars=4, max chars=17)
    Account holder's bank account number.
  - `routing_number` (optional, string, min chars=3, max chars=9)
    Bank account routing number.
  - `bank_code` (optional, string, max chars=20)
    Indicates the bank code.
  - `account_type` (optional, enumerated string)
    Represents the account type used to create a payment source. Available for [Authorize.net](https://www.authorize.net/) ACH and Razorpay NetBanking users only. If not passed, account type is taken as null.
    Possible enum values:
      - `checking`
        Checking Account
      - `savings`
        Savings Account
      - `business_checking`
        Business Checking Account
      - `current`
        Current Account
  - `account_holder_type` (optional, enumerated string)
    For Stripe ACH users only. Indicates the account holder type.
    Possible enum values:
      - `individual`
        Individual Account.
      - `company`
        Company Account.
  - `echeck_type` (optional, enumerated string)
    For Authorize.net ACH users only. Indicates the type of eCheck.
    Possible enum values:
      - `web`
        Payment Authorization obtained from the customer via the internet.
      - `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.
  - `issuing_country` (optional, string, max chars=50)
    [two-letter(alpha2)](https://www.iso.org/iso-3166-country-codes.html) ISO country code. Required when local bank details are provided, and not IBAN.
  - `swedish_identity_number` (optional, string, min chars=10, max chars=12)
    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.
  - `billing_address` (optional, jsonobject)
    The billing address associated with the bank account. The value is a JSON object with the following keys and their values:- `first_name`:(string, max chars=150) The first name of the contact.
    
    -   `last_name`:(string, max chars=150) The last name of the contact.
    -   `company_name`:(string, max chars=250) The company name for the address.
    -   `line1`:(string, max chars=180) The first line of the address.
    -   `line2`:(string, max chars=180) The second line of the address.
    -   `country`:(string) The name of the country for the address.
    -   `country_code`:(string, max chars=50) The two-letter, [ISO 3166 alpha-2](https://www.iso.org/iso-3166-country-codes.html) country code for the address.
    -   `state`:(string, max chars=50) The name of the state or province for the address. When not provided, this is set automatically for US, Canada, India, and UAE.
    -   `state_code`:(string, max chars=50) The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code/) without the country prefix. This is supported for USA, Canada, India, and UAE. For instance, for Arizona (USA), set state\_code as `AZ` (not `US-AZ`). For Tamil Nadu (India), set as `TN` (not `IN-TN`). For British Columbia (Canada), set as `BC` (not `CA-BC`). For Dubai (UAE), set as `DU` (not `AE-DU`).
    -   `city`:(string, max chars=50) The city name for the address.
    -   `postal_code`:(string, max chars=20) The postal or ZIP code for the address.
    -   `phone`:(string, max chars=50) The contact phone number for the address.
    -   `email`:(string, max chars=70) The contact email address for the address.

- `payment_method` (optional, enumerated string)
  Parameters for payment\_method
  - `type` (optional, enumerated string)
    The type of payment method. For more details refer [Update payment method for a customer](/docs/api/customers/update-payment-method-for-a-customer) API under Customer resource.
    Possible enum values:
      - `card`
        Card based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.
      - `paypal_express_checkout`
        Payments made via PayPal Express Checkout.
      - `amazon_payments`
        Payments made via Amazon Payments.
      - `direct_debit`
        Represents bank account for which the direct debit or ACH agreement/mandate is created.
      - `generic`
        Payments made via Generic Payment Method.
      - `alipay`
        Payments made via Alipay.
        
        This payment source is deprecated.
      - `unionpay`
        Payments made via UnionPay.
      - `apple_pay`
        Payments made via Apple Pay.
      - `wechat_pay`
        Payments made via WeChat Pay.
        
        This payment source is deprecated.
      - `ideal`
        Payments made via iDEAL.
      - `google_pay`
        Payments made via Google Pay.
      - `sofort`
        Payments made via Sofort.
      - `bancontact`
        Payments made via Bancontact Card.
      - `giropay`
        Payments made via giropay.
      - `dotpay`
        Payments made via Dotpay.
      - `upi`
        UPI Payments.
      - `netbanking_emandates`
        Netbanking (eMandates) Payments.
      - `venmo`
        Payments made via Venmo
      - `pay_to`
        Payments made via PayTo
      - `faster_payments`
        Payments made via Faster Payments
      - `sepa_instant_transfer`
        Payments made via Sepa Instant Transfer
      - `automated_bank_transfer`
        Represents virtual bank account using which the payment will be done.
      - `klarna_pay_now`
        Payments made via Klarna Pay Now
      - `online_banking_poland`
        Payments made via Online Banking Poland
      - `payconiq_by_bancontact`
        Payments made via Payconiq by Bancontact.
      - `electronic_payment_standard`
        Electronic Payment Standard
      - `kbc_payment_button`
        KBC Payment Button
      - `pay_by_bank`
        Pay By Bank
      - `trustly`
        Trustly
      - `stablecoin`
        Payments made via Stablecoin.
      - `kakao_pay`
        Payments made via Kakao Pay.
      - `naver_pay`
        Payments made via Naver Pay.
      - `revolut_pay`
        Payments made via Revolut Pay.
      - `cash_app_pay`
        Payments made via Cash App Pay.
      - `twint`
        Payments made via Twint
      - `go_pay`
        Payments made via GoPay
      - `grab_pay`
        Payments made via GrabPay
      - `pay_co`
        Payments made via PayCo
      - `after_pay`
        Payments made via Afterpay
      - `swish`
        Payments made via Swish
      - `payme`
        Payments made via PayMe
      - `pix`
        Payments made via Pix
      - `klarna`
        Payments made via Klarna.
      - `alipay_hk`
        Payments made via Alipay HK.
      - `paypay`
        Payments made via PayPay
      - `gcash`
        Payments made via GCash.
      - `south_korean_cards`
        Payments made via South Korean Cards
      - `paynow`
      - `bizum`
      - `promptpay`
      - `dana`
        Payments made via Dana.
      - `touch_n_go`
        Payments made via Touch 'n Go.
      - `tamara`
        Payments made via Tamara.
      - `qpay`
        Payments made via Qpay.
      - `ovo`
      - `momo`
      - `mercado_pago`
      - `nequi`
      - `nupay`
      - `picpay`
      - `thai_qr`
      - `blik`
      - `fpx`
      - `wero`
      - `p24`
      - `affirm_pay`
      - `rakuten_pay`
  - `gateway_account_id` (optional, string, max chars=50)
    The gateway account in which this payment source is stored.
  - `reference_id` (optional, string, max chars=200)
    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](/docs/api/customers/update-payment-method-for-a-customer) API under Customer resource.
  - `tmp_token` (required if reference_id not provided, string, max chars=65k)
    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.
  - `issuing_country` (optional, string, max chars=50)
    [ISO 3166 alpha-2 country code](https://www.iso.org/iso-3166-country-codes.html) .
    
    **Note**: If you enter an invalid country code, the system will return an error.
    
    If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, then `XI` (the code for **United Kingdom - Northern Ireland** ) is available as an option.
  - `additional_information` (optional, jsonobject)
    -   `checkout_com`: While adding a new payment method using [permanent token](/docs/api/payment_sources/create-using-permanent-token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://www.checkout.com/docs/previous/payments/payment-methods/cards/dlocal).
        
        -   `payer`: User related information.
            -   `country_of_residence`: This is required since the billing country associated with the user's payment method may not be the same as their country of residence. Hence the user's country of residence needs to be specified. The country code should be a [two-character ISO code](https://docs.checkout.com/resources/codes/country-codes).
            -   `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country.
    -   `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) required to perform anti-fraud validation.
    -   `braintree`: While passing raw card details to Braintree, your `fraud_merchant_id` and the user's `device_session_id` can be added to perform [additional validation](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) and avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `device_session_id`: Session ID associated with the user's device.
            -   `fraud_merchant_id`: Your [merchant ID](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) for fraud detection.
    -   `chargebee_payments`: While passing raw card details to Chargebee Payments, if `fraud_session_id` is added, additional validation is performed to avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `fraud_session_id`: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.
    -   `bank_of_america`: While passing raw card details to Bank of America, your user's `device_session_id` can be added to perform additional validation and avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `device_session_id`: Session ID associated with the user's device.
    -   `ecentric`: This parameter is used to verify and process payment method details in Ecentric. If the `merchant_id` parameter is included, Chargebee will vault it / perform a lookup and verification against this `merchant_id`, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part.
        
        -   `merchant_id`: Merchant GUID where the card is vaulted or need to be vaulted.
    -   `ebanx`: While passing raw card details to EBANX, the user's `document` is required for some countries and `device_session_id` can be added to perform [additional validation](https://developer.ebanx.com/docs/payments/guides/features/device-fingerprint#device-fingerprint) and avoid fraudulent transactions.
        
        -   `payer`: User related information.
            -   `document`: Document is the user's identification number based on their country.
        -   `fraud`: Fraud identification related information.
            -   `device_session_id`: Session ID associated with the user's device

- `payment_intent` (optional, string)
  Parameters for payment\_intent
  - `id` (optional, string, max chars=150)
    Identifier for the [`payment_intent`](/docs/api/payment_intents) resource. If you provide this parameter, you do not need to pass other `payment_intent` parameters.
  - `gateway_account_id` (required if payment intent token provided, string, max chars=50)
    The gateway account used for performing the 3DS flow.
  - `gw_token` (optional, string, max chars=65k)
    Identifier for 3DS transaction/verification object at the gateway. Can be passed only after successfully completing the 3DS flow. Refer [3DS implementation in Chargebee](/docs/api/3ds_card_payments) to find out the gateway-specific gw\_token format. Applicable when you are using gateway APIs directly for completing the 3DS flow.
  - `payment_method_type` (optional, enumerated string)
    The payment method type.
    
    **Default value**
    
    -   `card`
    Possible enum values:
      - `card`
        card
      - `ideal`
        ideal
      - `sofort`
        sofort
      - `bancontact`
        bancontact
      - `google_pay`
        google\_pay
      - `dotpay`
        dotpay
      - `giropay`
        giropay
      - `apple_pay`
        apple\_pay
      - `upi`
        upi
      - `netbanking_emandates`
        netbanking\_emandates
      - `paypal_express_checkout`
        paypal\_express\_checkout
      - `direct_debit`
        direct\_debit
      - `boleto`
        boleto
      - `venmo`
        Venmo
      - `amazon_payments`
        Amazon Payments
      - `pay_to`
        PayTo
      - `faster_payments`
        Faster Payments
      - `sepa_instant_transfer`
        Sepa Instant Transfer
      - `klarna_pay_now`
        Klarna Pay Now
      - `online_banking_poland`
        Online Banking Poland
      - `payconiq_by_bancontact`
        Payments made via Payconiq by Bancontact.
      - `electronic_payment_standard`
        Electronic Payment Standard
      - `kbc_payment_button`
        KBC Payment Button
      - `pay_by_bank`
        Pay By Bank
      - `trustly`
        Trustly
      - `stablecoin`
        Payments made via Stablecoin.
      - `kakao_pay`
        Payments made via Kakao Pay.
      - `naver_pay`
        Payments made via Naver Pay.
      - `revolut_pay`
        Payments made via Revolut Pay.
      - `cash_app_pay`
        Payments made via Cash App Pay.
      - `wechat_pay`
        Payments made via WeChat Pay.
      - `alipay`
        Payments made via Alipay.
      - `twint`
        Payments made via Twint
      - `go_pay`
        Payments made via GoPay
      - `grab_pay`
        Payments made via GrabPay
      - `pay_co`
        Payments made via PayCo
      - `after_pay`
        Payments made via Afterpay
      - `swish`
        Payments made via Swish
      - `payme`
        Payments made via PayMe
      - `pix`
        Pix
      - `klarna`
        Payments made via Klarna.
      - `alipay_hk`
        Payments made via Alipay HK.
      - `paypay`
        PayPay
      - `gcash`
        Payments made via GCash.
      - `south_korean_cards`
        Payments made via South Korean Cards
      - `paynow`
      - `bizum`
      - `promptpay`
      - `dana`
        Payments made via Dana.
      - `touch_n_go`
        Payments made via Touch 'n Go.
      - `tamara`
        Payments made via Tamara.
      - `qpay`
        Payments made via Qpay.
      - `ovo`
      - `momo`
      - `mercado_pago`
      - `nequi`
      - `nupay`
      - `picpay`
      - `thai_qr`
      - `blik`
      - `fpx`
      - `wero`
      - `p24`
      - `affirm_pay`
      - `rakuten_pay`
  - `reference_id` (optional, string, max chars=65k)
    Identifier for Braintree permanent token. Applicable when you are using Braintree APIs for completing the 3DS flow.
  - `additional_information` (optional, jsonobject)
    -   `checkout_com`: While adding a new payment method using [permanent token](/docs/api/payment_sources/create-using-permanent-token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://www.checkout.com/docs/previous/payments/payment-methods/cards/dlocal).
        
        -   `payer`: User related information.
            -   `country_of_residence`: This is required since the billing country associated with the user's payment method may not be the same as their country of residence. Hence the user's country of residence needs to be specified. The country code should be a [two-character ISO code](https://docs.checkout.com/resources/codes/country-codes).
            -   `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country.
    -   `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) required to perform anti-fraud validation.
    -   `braintree`: While passing raw card details to Braintree, your `fraud_merchant_id` and the user's `device_session_id` can be added to perform [additional validation](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) and avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `device_session_id`: Session ID associated with the user's device.
            -   `fraud_merchant_id`: Your [merchant ID](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) for fraud detection.
    -   `chargebee_payments`: While passing raw card details to Chargebee Payments, if `fraud_session_id` is added, additional validation is performed to avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `fraud_session_id`: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.
    -   `bank_of_america`: While passing raw card details to Bank of America, your user's `device_session_id` can be added to perform additional validation and avoid fraudulent transactions.
        
        -   `fraud`: Fraud identification related information.
            -   `device_session_id`: Session ID associated with the user's device.
    -   `ecentric`: This parameter is used to verify and process payment method details in Ecentric. If the `merchant_id` parameter is included, Chargebee will vault it / perform a lookup and verification against this `merchant_id`, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part.
        
        -   `merchant_id`: Merchant GUID where the card is vaulted or need to be vaulted.
    -   `ebanx`: While passing raw card details to EBANX, the user's `document` is required for some countries and `device_session_id` can be added to perform [additional validation](https://developer.ebanx.com/docs/payments/guides/features/device-fingerprint#device-fingerprint) and avoid fraudulent transactions.
        
        -   `payer`: User related information.
            -   `document`: Document is the user's identification number based on their country.
        -   `fraud`: Fraud identification related information.
            -   `device_session_id`: Session ID associated with the user's device

- `billing_address` (optional, string)
  Parameters for billing\_address
  - `first_name` (optional, string, max chars=150)
    The first name of the billing contact.
  - `last_name` (optional, string, max chars=150)
    The last name of the billing contact.
  - `email` (optional, string, max chars=70)
    The email address.
  - `company` (optional, string, max chars=250)
    The company name.
  - `phone` (optional, string, max chars=50)
    The phone number.
  - `line1` (optional, string, max chars=150)
    Address line 1
  - `line2` (optional, string, max chars=150)
    Address line 2
  - `line3` (optional, string, max chars=150)
    Address line 3
  - `city` (optional, string, max chars=50)
    The name of the city.
  - `state_code` (optional, string, max chars=50)
    The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada, India and UAE. For instance, for Arizona (USA), set `state_code` as `AZ` (not `US-AZ` ). For Tamil Nadu (India), set as `TN` (not `IN-TN` ). For British Columbia (Canada), set as `BC` (not `CA-BC` ). For Dubai (UAE), set as `DU` (not `AE-DU` ).
  - `state` (optional, string, max chars=50)
    The state/province name. Is set by Chargebee automatically for US, Canada, India and UAE, if `state_code` is provided.
  - `zip` (optional, string, max chars=20)
    Zip or postal code. The number of characters is validated according to the rules [specified here](https://chromium-i18n.appspot.com/ssl-address) .
  - `country` (optional, string, max chars=50)
    The billing address country of the customer. Must be one of [ISO 3166 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) .
    
    **Brexit**
    
    If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or later, or have [manually enable](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, then `XI` (the code for **United Kingdom - Northern Ireland**) is available as an option.
  - `validation_status` (optional, enumerated string, default=not_validated)
    The address verification status.
    Possible enum values:
      - `not_validated`
        Address is not yet validated.
      - `valid`
        Address was validated successfully.
      - `partially_valid`
        The address is valid for taxability but has not been validated for shipping.
      - `invalid`
        Address is invalid.

- `entity_identifiers` (optional, array)
  Parameters for entity\_identifiers
  - `id` (optional, string, max chars=40)
    The unique id for the `entity_identifier` in Chargebee. When not provided, it is autogenerated.
  - `scheme` (optional, string, max chars=50)
    The Peppol BIS scheme associated with the `[vat_number](/docs/api/customers/customer-object#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](https://www.chargebee.com/docs/e-invoicing.html#supported-countries) .
    
    **Tip:**
    
    If there is only one entity identifier for the customer and the value is the same as `vat_number`, then there is no need to provide the `entity_identifiers[]` array. See [description for `entity_identifiers[]`](/docs/api/customers/customer-object#entity_identifiers).
  - `value` (optional, string, max chars=50)
    The value of the `entity_identifier`. This identifies the customer entity on the Peppol network. For example: `10101010-STO-10` .
    
    **Tip:**
    
    If there is only one entity identifier for the customer and the value is the same as `vat_number`, then there is no need to provide the `entity_identifiers[]` array. See [description for `entity_identifiers[]`](/docs/api/customers/customer-object#entity_identifiers).
  - `standard` (optional, string, 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 is only one entity identifier for the customer and the value is the same as `vat_number`, then there is no need to provide the `entity_identifiers[]` array. See [description for `entity_identifiers[]`](/docs/api/customers/customer-object#entity_identifiers).

- `tax_providers_fields` (optional, array)
  Parameters for tax\_providers\_fields
  - `provider_name` (optional, string, max chars=50)
    Name of the tax provider.
  - `field_id` (optional, string, max chars=50)
    Field id of the attribute which tax vendor has provided while getting onboarded with Chargebee.
  - `field_value` (optional, string, max chars=50)
    The value of the related tax field

## Returns

- `customer` (Customer object)
  Resource object representing customer

- `card` (Card object)
  Resource object representing card
