> ## Documentation Index
> Fetch the complete documentation index at: https://rain-sandbox-trial.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# card.updated

<Update label="v1.5.0" description="minor update">
  ### primaryAccountIdentifier renamed to networkCardId

  The `primaryAccountIdentifier` field is no longer emitted. Its value now ships as `networkCardId`. Versions 1.4.0 and below continue to emit `primaryAccountIdentifier`.

  | Field           | Type                | Description                                                                                                                     |
  | --------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
  | `networkCardId` | `string` (optional) | The card's network token identifier. Present only for programs with network token reporting enabled; contact Rain to enable it. |
</Update>

<Update label="v1.4.0" description="minor update">
  ### currency field added

  | Field      | Type                | Description                                                              |
  | ---------- | ------------------- | ------------------------------------------------------------------------ |
  | `currency` | `string` (optional) | The program's primary currency, lowercase ISO-4217 (for example, `usd`). |
</Update>

<Update label="v1.3.0" description="minor update">
  ### successorCard field added

  When Rain replaces a card (the webhook carries `statusChangeReason: "card_replaced"`), the payload now identifies the new card so you can update your records without polling.

  | Field                           | Type                | Description                                                                                 |
  | ------------------------------- | ------------------- | ------------------------------------------------------------------------------------------- |
  | `successorCard`                 | `object` (optional) | The card that replaced this one. Present only when `statusChangeReason` is `card_replaced`. |
  | `successorCard.id`              | `string`            | Rain card ID of the new card                                                                |
  | `successorCard.last4`           | `string`            | Last 4 digits of the new card number                                                        |
  | `successorCard.expirationMonth` | `string`            | New card expiration month                                                                   |
  | `successorCard.expirationYear`  | `string`            | New card expiration year                                                                    |
</Update>

<Update label="v1.2.0" description="minor update">
  ### createdAt, updatedAt, and primaryAccountIdentifier fields added

  | Field                      | Type                | Description                                                                |
  | -------------------------- | ------------------- | -------------------------------------------------------------------------- |
  | `createdAt`                | `string`            | ISO-8601 timestamp of when the card was created                            |
  | `updatedAt`                | `string`            | ISO-8601 timestamp of this update                                          |
  | `primaryAccountIdentifier` | `string` (optional) | The card's network token identifier. Renamed to `networkCardId` in v1.5.0. |
</Update>

<Update label="v1.1.0" description="minor update">
  ### statusChangeReason field added

  Added the `statusChangeReason` field to the `card.updated` webhook payload. This field provides context about why the card status changed.

  #### New Field

  | Field                | Type                | Description                           |
  | -------------------- | ------------------- | ------------------------------------- |
  | `statusChangeReason` | `string` (optional) | The reason for the card status change |

  #### Possible Values for `statusChangeReason`

  **Lock reasons:**

  | Value                | Description                                                      |
  | -------------------- | ---------------------------------------------------------------- |
  | `api_lock_request`   | Card locked via the lock card endpoint                           |
  | `pin_limit_exceeded` | Card automatically locked due to too many incorrect PIN attempts |

  **Unlock reasons:**

  | Value                       | Description                                   |
  | --------------------------- | --------------------------------------------- |
  | `api_unlock_request`        | Card unlocked via the unlock card endpoint    |
  | `last_4_api_unlock_request` | Card activated via the verify last 4 endpoint |

  **Cancel reasons:**

  | Value                             | Description                                                           |
  | --------------------------------- | --------------------------------------------------------------------- |
  | `api_deactivate_endpoint_request` | Card canceled via the deactivate card endpoint                        |
  | `api_cancel_request`              | Card canceled via the update card endpoint (status set to `canceled`) |
  | `api_update_cancel_request`       | Card canceled via the update card endpoint                            |
  | `user_deleted`                    | Card canceled because the associated user was deleted                 |
  | `team_member_deleted`             | Card canceled because the team member was removed                     |
  | `card_replaced`                   | Card canceled because it was replaced with a new card                 |

  **General:**

  | Value                | Description                                      |
  | -------------------- | ------------------------------------------------ |
  | `api_update_request` | Card status changed via the update card endpoint |

  **Tokenization reasons:**

  | Value                | Description                                                |
  | -------------------- | ---------------------------------------------------------- |
  | `wallet_provisioned` | Card was added to a digital wallet (Apple Pay, Google Pay) |

  **Internal reasons:**

  | Value            | Description                                |
  | ---------------- | ------------------------------------------ |
  | `rain_initiated` | Card status was changed internally by Rain |

  #### Example Payload

  ```json theme={null}
  {
      "id": "bda1b5ca-2bca-4c62-8e17-d80ee6f5aa59",
      "resource": "card",
      "action": "updated",
      "version": "1.1.0",
      "body": {
          "id": "277a9918-d463-4bf2-a783-116d02cb9a51",
          "userId": "5086685d-3849-4ec8-bb94-6a2afb73663b",
          "type": "virtual",
          "status": "canceled",
          "limit": {
              "amount": 8000,
              "frequency": "per24HourPeriod"
          },
          "last4": "5600",
          "expirationMonth": "4",
          "expirationYear": "2032",
          "statusChangeReason": "api_update_cancel_request"
      }
  }
  ```
</Update>

<Update label="v1.0.0" description="initial release">
  ### card.updated webhook

  Added the `card.updated` webhook. Rain sends this webhook when a card status changes or when a user adds their card to a digital wallet.

  #### Payload Fields

  | Field                  | Type                  | Description                                                                                                         |
  | ---------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------- |
  | `id`                   | `string`              | Webhook ID                                                                                                          |
  | `resource`             | `string`              | Always `"card"`                                                                                                     |
  | `action`               | `string`              | Always `"updated"`                                                                                                  |
  | `version`              | `string`              | The webhook version                                                                                                 |
  | `body.id`              | `string`              | Rain card ID                                                                                                        |
  | `body.userId`          | `string`              | ID of the cardholder user                                                                                           |
  | `body.type`            | `string`              | `"virtual"` or `"physical"`                                                                                         |
  | `body.status`          | `string`              | Card status: `"active"`, `"locked"`, `"canceled"`, or `"notActivated"`                                              |
  | `body.limit`           | `object` (optional)   | Spending limit configuration                                                                                        |
  | `body.limit.amount`    | `number`              | Limit amount in cents                                                                                               |
  | `body.limit.frequency` | `string`              | `"per24HourPeriod"`, `"per7DayPeriod"`, `"per30DayPeriod"`, `"perYearPeriod"`, `"allTime"`, or `"perAuthorization"` |
  | `body.last4`           | `string`              | Last 4 digits of the card number                                                                                    |
  | `body.expirationMonth` | `string`              | Card expiration month (no leading zero)                                                                             |
  | `body.expirationYear`  | `string`              | Card expiration year                                                                                                |
  | `body.tokenWallets`    | `string[]` (optional) | Digital wallets where the card is tokenized: `"Apple"` or `"Google Pay"`                                            |

  #### Example Payload

  ```json theme={null}
  {
      "id": "5f1bb6ba-0981-405c-80fb-316f99508bab",
      "resource": "card",
      "action": "updated",
      "version": "1.0.0",
      "body": {
          "id": "94534236-927b-44f3-9429-27994c7ebc49",
          "userId": "6d73762a-c401-4898-8f00-d85707e310c0",
          "type": "virtual",
          "status": "active",
          "limit": {
              "amount": 2000000,
              "frequency": "per24HourPeriod"
          },
          "last4": "4904",
          "expirationMonth": "4",
          "expirationYear": "2029",
          "tokenWallets": ["Apple"]
      }
  }
  ```
</Update>
