# Update an account card

Source: https://developers.swell.is/backend-api/account-cards/update-an-account-card

Update an existing account card using the ID that was returned when created.

## Arguments

- `id` (objectId, required): Unique identifier for the account card.
- `name` (string): Full name of the customer. If `first_name` or `last_name` are updated, then `name` will be automatically updated as a combination of first/last.
- `first_name` (string): Customer's first name. If `name` is updated, then `first_name` will be automatically updated as the first word of the name.
- `last_name` (string): If `name` is updated, then `last_name` will be automatically updated as the last words of the name.
- `address1` (string): Billing address line 1: street address/PO box/company name.
- `address2` (string): Billing address line 2: apartment/suite/unit/building.
- `city` (string): Billing city/district/suburb/town/village.
- `state` (string): Billing state/county/province/region.
- `zip` (string): Billing zip/postal code.
- `country` (string): Two-letter ISO country code.
- `brand` (string): Credit card brand. Can be `American Express`, `Diners Club`, `Discover`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
- `exp_month` (int): Two-digit number representing the credit card expiration month.
- `exp_year` (int): Four-digit number representing the credit card expiration year.
- `last4` (string): Last four digits of the card number.

## Example request

`PUT /accounts:cards/:id`

**cURL**

```sh
$ curl https://api.swell.store/accounts:cards/62ceea552fa37600132911f6 \
  -u store-id:secret-key \
  -d exp_month=11 \
  -d exp_year=2025 \
  -X PUT
```

**Node**

```javascript
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');

await swell.put('/accounts:cards/{id}', {
  id: '62ceea552fa37600132911f6',
  exp_month: 11,
  exp_year: 2025
});
```

**PHP**

```php
<?php $swell = new \Swell\Client('store-id', 'secret-key');

$swell->put('/accounts:cards/{id}', [
  'id' => '62ceea552fa37600132911f6',
  'exp_month' => 11,
  'exp_year' => 2025
]);
```

## Example response

```json
{
  "parent_id": "621e53a6213eaf013d1fa6b2",
  "billing": {
    "name": "Jarl Balgruff",
    "first_name": "Jarl",
    "last_name": "Balgruff",
    "address1": "543 Castle Way",
    "address2": null,
    "city": "Whiterun",
    "state": "CA",
    "zip": null,
    "country": "US",
    "phone": null,
    "company": null
  },
  "brand": "Visa",
  "last4": "1234",
  "exp_month": 11,
  "exp_year": 2025,
  "token": "card_QD4rOXP3I5bOmUCKlmLo8AzC",
  "address_check": "unchecked",
  "zip_check": "unchecked",
  "cvc_check": "unchecked",
  "fingerprint": "3618a9581fec797682e06740212c08f3",
  "date_created": "2022-07-13T15:52:53.253Z",
  "active": true,
  "date_updated": "2022-07-18T20:00:49.662Z",
  "id": "62ceea552fa37600132911f6"
}
```
