# Account Updater

Your customer's card details may change due to expiration, loss, or other account changes. This may result in refused outcomes if you attempt subsequent Customer Initiated Transactions (CITs) or Merchant Initiated Transactions (MITs) using outdated credentials.

## Receive real-time account updates

Your customer's card details can either be stored by you, or by us in a [Worldpay token](/products/tokens). When you submit payment requests using these card details, we can check if updated card details are available before attempting a payment authorization.

We have two offerings available:

* Managed - we apply merchant configuration to your `entity` and automatically check for updated card details when you attempt qualifying payments. No changes are required to your payment requests.
* Request a real-time account update in your payment request by setting the `instruction.requestAccountUpdater` boolean to `true`.


In both cases, if updated card details are available, we apply them before requesting payment authorization. We return updated card details in the `updatedPaymentInstrument` object in our response.

You can supply `requestAccountUpdater` in MITs and only those CITs where `customerAgreement.storedCardUsage` is set to `subsequent`.

## Request

Set `instruction.requestAccountUpdater` to `true` to request updated card details for the `paymentInstrument` supplied. If the stored card details, that you have provided for the transaction, are no longer valid and new credentials are available, the authorization is processed with the new card and its details are returned in the `updatedPaymentInstrument` object in our response.

No changes are required in the request body if you are using our "Managed Account Updater" offering.

To trigger specific scenarios in testing, use the magic values available in our [Account Updater testing guidance](/products/card-payments/testing#real-time-account-updater-test-values).

### Request example

Account Updater (Request)

```json
{
    "transactionReference": "Memory265-13/08/1876",
    "channel": "ecom",
    "merchant": {
        "entity": "default"
    },
    "instruction": {
        "requestAutoSettlement": {
            "enabled": false
        },
        "narrative": {
            "line1": "Mind Palace"
        },
        "value": {
            "currency": "GBP",
            "amount": 250
        },
        "paymentInstrument": {
            "type": "card/plain",
            "cardNumber": "4444333322221111",
            "expiryDate": {
                "month": 5,
                "year": 2035
            }
        },
        "customerAgreement":{
            "type": "cardOnFile",
            "storedCardUsage": "subsequent"
        },
        "requestAccountUpdater": true
    }
}
```

## Response

If updated card details have been applied in your request, the `updatedPaymentInstrument` object is returned in the response.


```json
{
  "$ref": "#/components/schemas/updatedPaymentInstrument",
  "components": {
    "schemas": {
      "updatedPaymentInstrument": {
        "type": "object",
        "description": "Details of the updated payment instrument.",
        "properties": {
          "appliedNetworkToken": {
            "type": "boolean",
            "description": "Returned if the payment instrument was swapped for a network token."
          },
          "accountUpdaterMessage": {
            "type": "string",
            "description": "Details on the type of payment instrument update.",
            "enum": [
              "The merchant is not registered in the update program",
              "The account number was changed",
              "The account was closed",
              "TThe expiration date was changed",
              "The issuing bank does not participate in the update program",
              "Contact the cardholder for updated information",
              "No match found",
              "No changes found"
            ],
            "x-enumDescriptions": {
              "The account number was changed": "A new card has been issued with a change in the card number. Returned for both Real-Time and Managed Account Updater.",
              "The account was closed": "The account is closed and the card is no longer valid. Ask your customer for an alternative payment method. Returned for both Real-Time and Managed Account Updater.",
              "The expiration date was changed": "A new card has been issued with an updated expiry date. In most cases the card number remains unchanged. Returned for both Real-Time and Managed Account Updater.",
              "The issuing bank does not participate in the update program": "It is not known whether an account update is available. Returned for Managed Account Updater only.",
              "Contact the cardholder for updated information": "A match was found but you may need to contact the cardholder for updated card details. This could be due to cardholder opt-out or other reasons. Returned for both Real-Time and Managed Account Updater."
            },
            "example": "The account number was changed"
          },
          "type": {
            "type": "string",
            "example": "card/plain+masked"
          },
          "cardBin": {
            "pattern": "^[0-9*]+$",
            "type": "string",
            "description": "The updated card BIN (Bank Identification Number).",
            "example": "444433"
          },
          "lastFour": {
            "pattern": "^[0-9*]+$",
            "type": "string",
            "description": "The four digits of the updated card. Some characters may be obfuscated with a `*` if the PAN length is less than 16 characters.",
            "example": 1111
          },
          "cardNumber": {
            "type": "string",
            "description": "The full card number of the updated card. Returned only for merchants configured to receive card numbers that are not obfuscated.",
            "maxLength": 19,
            "minLength": 12,
            "pattern": "^[0-9]+$"
          },
          "expiryDate": {
            "type": "object",
            "properties": {
              "month": {
                "type": "integer"
              },
              "year": {
                "type": "integer"
              }
            }
          },
          "cardBrand": {
            "type": "string",
            "description": "The brand of the updated card. In rare circumstances a card may be reissued under a different brand."
          },
          "countryCode": {
            "type": "string",
            "maxLength": 2,
            "minLength": 2,
            "pattern": "^[A-Z]*$",
            "description": "Country code of the updated card in [ISO 3166-1 Alpha-2 format](/products/reference/supported-countries-currencies#iso-country-codes).",
            "example": "GB"
          },
          "fundingType": {
            "type": "string",
            "description": "How the card is funded."
          }
        }
      }
    }
  }
}
```

### Response examples

Account Updater (Response)

```json
{
    "outcome": "authorized",
    "paymentId": "pay28NdG68sv-13_sDcu5Bwt0",
    "commandId": "cmd8hJcb20_sh2-sbRjx88wL0",
    "riskFactors": [
        {
            "type": "cvc",
            "risk": "notSupplied"
        },
        {
            "type": "avs",
            "risk": "notChecked",
            "detail": "address"
        },
        {
            "type": "avs",
            "risk": "notChecked",
            "detail": "postcode"
        }
    ],
    "issuer": {
        "authorizationCode": "12345A"
    },
    "scheme": {
        "reference": "060720116005060"
    },
    "updatedPaymentInstrument": {
        "cardBin": "491183",
        "lastFour": "0000",
        "expiryDate": {
            "month": 9,
            "year": 2031
        },
        "cardBrand": "visa",
        "fundingType": "credit",
        "accountUpdaterMessage": "The account number was changed",
        "type": "card/plain+masked"
    },
    "paymentInstrument": {
        "type": "card/plain+masked",
        "cardBin": "444433",
        "lastFour": "1111",
        "category": "consumer",
        "expiryDate": {
            "month": 5,
            "year": 2023
        },
        "cardBrand": "visa",
        "fundingType": "credit",
        "issuerName": "Some Issuer PLC",
        "paymentAccountReference": "Q1HJZ28RKA1EBL470G9XYG90R5D3E"
    },
    "_links": {
        "cardPayments:cancel": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/authorizations/cancellations/eyJrIjoiazNhYjYzMiI="
        },
        "cardPayments:partialCancel": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/authorizations/cancellations/partials/eyJrIjoiazNhYjYzMiJ9"
        },
        "cardPayments:settle": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/settlements/full/eyJrIjoiazNhYjYzMiI="
        },
        "cardPayments:partialSettle": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/settlements/partials/eyJrIjoiazNhYjYzMiI="
        },
        "cardPayments:events": {
            "href": "https://try.access.worldpay-bsh.securedataplatform.com/payments/events/eyJrIjoiazNhYjYzMiI="
        },
        "curies": [
            {
                "name": "cardPayments",
                "href": "https://try.access.worldpay-bsh.securedataplatform.com/rels/cardPayments/{rel}",
                "templated": true
            }
        ]
    }
}
```