# Cards

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


This resource helps you to retrieve, update, and delete card details for a customer.

## Sample Card

```json
{
  "card_type": "american_express",
  "customer_id": "__test__XpbTXGTSRp3gtJDI",
  "expiry_month": 12,
  "expiry_year": 2022,
  "gateway": "chargebee",
  "iin": "378282",
  "last4": "0005",
  "masked_number": "***********0005",
  "object": "card",
  "reference_id": "tok___test__XpbTXGTSRp3gxDDL",
  "status": "valid"
}
```

## Cards attributes

## Input Parameters

- `status` (required, enumerated string)
  Current status of the card.
  Possible enum values:
    - `valid`
      A valid and active credit card
    - `expiring`
      A card which is expiring in the current month.
    - `expired`
      An expired card

- `gateway` (required, enumerated string)
  Name of the gateway this payment source is stored with.
  Possible enum values:
    - `chargebee`
      Chargebee test gateway.
    - `stripe`
      Stripe is a payment gateway.
    - `braintree`
      Braintree is a payment gateway.
    - `authorize_net`
      Authorize.net is a payment gateway
    - `paypal_pro`
      PayPal Pro Account is a payment gateway.
    - `pin`
      Pin is a payment gateway
    - `eway`
      eWAY Account is a payment gateway.
    - `eway_rapid`
      eWAY Rapid is a payment gateway.
    - `worldpay`
      WorldPay is a payment gateway
    - `balanced_payments`
      Balanced is a payment gateway
    - `beanstream`
      Bambora(formerly known as Beanstream) is a payment gateway.
    - `bluepay`
      BluePay is a payment gateway.
    - `elavon`
      Elavon Virtual Merchant is a payment solution.
    - `first_data_global`
      First Data Global Gateway Virtual Terminal Account
    - `hdfc`
      HDFC Account is a payment gateway.
    - `migs`
      MasterCard Internet Gateway Service payment gateway.
    - `nmi`
      NMI is a payment gateway.
    - `ogone`
      Ingenico ePayments (formerly known as Ogone) is a payment gateway.
    - `paymill`
      PAYMILL is a payment gateway.
    - `paypal_payflow_pro`
      PayPal Payflow Pro is a payment gateway.
    - `sage_pay`
      Sage Pay is a payment gateway.
    - `tco`
      2Checkout is a payment gateway.
    - `wirecard`
      WireCard Account is a payment service provider.
    - `not_applicable`
      Indicates that payment gateway is not applicable for this resource.

- `reference_id` (optional, string, max chars=200)
  The identifier provided by the gateway/card vault for the specific payment method resource.

- `first_name` (optional, string, max chars=50)
  Cardholder's first name

- `last_name` (optional, string, max chars=50)
  Cardholder's last name

- `iin` (required, string, min chars=6, max chars=6)
  The Issuer Identification Number, i.e. the first six digits of the card number

- `last4` (required, string, min chars=4, max chars=4)
  Last four digits of the card number

- `card_type` (optional, enumerated string)
  Card type
  Possible enum values:
    - `visa`
      A Visa card.
    - `mastercard`
      A MasterCard.
    - `american_express`
      An American Express card.
    - `discover`
      A Discover card.
    - `jcb`
      A JCB card.
    - `diners_club`
      A Diner's Club card.
    - `bancontact`
      A Bancontact card.
    - `other`
      Card belonging to types other than those listed above.
    - `not_applicable`
      Used for offline entries in transactions. Not applicable for cards

- `expiry_month` (required, integer, min=1, max=12)
  Card expiry month.

- `expiry_year` (required, integer)
  Card expiry year.

- `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) 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.

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

- `billing_zip` (optional, string, max chars=20)
  Postal or Zip code, as available in card billing address.

- `ip_address` (optional, string, max chars=50)
  The IP address of the customer. Used primarily for referral integration and EU VAT validation.

- `customer_id` (required, string, max chars=50)
  Identifier of the customer.

- `masked_number` (optional, string, max chars=19)
  Masked credit card number that is safe to show.

