Learn how you can set up cards to automatically receive updates.

If you're interested in using the card account updater service, [contact Moov](https://support.moov.io/) for more information.

## What is a card account updater?

A card account updater is a solution that helps businesses ensure that customer credit card information is up-to-date. The card account updater automatically updates payment information when a card has expired or been replaced, eliminating the need to contact cardholders to obtain new information.

When details change on a card linked to Moov, such as the card number or the expiration date, Moov's card account updater service will automatically update the information on your behalf.

## Set cardOnFile

You must follow the instructions to [save a card for future use](https://docs.moov.io/guides/sources/cards/#save-a-card-for-future-use) during card linking to use the card account updater service.

If `cardOnFile` was set to **true** during the card linking and [verification](https://docs.moov.io/guides/sources/cards/#save-a-card-for-future-use) process, the card will be stored and opted in to automatic updates from the issuer.

The `merchantAccountID` is also set during card linking and [verification](https://docs.moov.io/guides/sources/cards/#card-verification), and specifies two things:

- The merchant that is authorized to store card details
- The merchant that will be billed for updates

By default, `cardOnFile` is set to **false**, and `merchantAccountID` is set to your platform's account ID. To update a linked card's `cardOnFile` or `merchantAccountID`, and opt-in to automatic updates from the issuer, you can use the card `PATCH` [endpoint](https://docs.moov.io/api/sources/cards/update/).

## View updated card details

The card networks will communicate the following types of updates:

| Update type           | Description                                                                 | Action                              |
|----------------------|-----------------------------------------------------------------------------|-------------------------------------|
| `number-update`      | A new account number has been provided, or a new account number _and_ expiration date has been provided | PAN is updated with new record      |
| `expiration-update`  | A new expiration date has been provided                                     | Expiration is updated with new record|
| `contact-cardholder` | A match was found, but the account information on file may not be current   | Contact cardholder                  |
| `account-closed`     | The account is closed (possibly due to permanent closure or fraud)         | Disable card                        |

You can view the last update to the card by using the card `GET` [endpoint](https://docs.moov.io/api/sources/cards/get/). In the response, you'll receive the last update type and the date the details were updated on.

Ask

```json
{
  "cardID": "ec7e1848-dc80-4ab0-8827-dd7fc0737b43",
  "cardAccountUpdater": {
    "updateType": "number-update",
    "updatedOn": "datetime"
  }
}
```

## Webhooks

An event is fired when there's an update to any of the following card details:

- `number-update`
- `expiration-update`
- `contact-cardholder`
- `account-closed`

Use the `card.autoUpdated` webhook, which will respond with the following event payload:

Ask

```json
{
 "eventID": "14980a04-2e32-4921-a771-4959a36534a6",
 "type": "card.autoUpdated",
 "data": {
   "cardID": "51015d0d-8dca-49a0-ba70-abfed073f785",
   "accountID": "51015d0d-8dca-49a0-ba70-abfed073f785",
   "updateType": "number-update"
 },
 "createdOn": "2021-09-02T13:57:50Z"
}
```

If you'd like to learn more about webhooks, view the [webhooks](https://docs.moov.io/guides/webhooks/) guide.
