---
updatedAt: 2026-11-02T15:13:18.000Z
agentTools:
  projectIndex: https://developer.spreedly.com/llms.txt
---

# iFrame recache

API docs for version 1 of the Spreedly iFrame Javascript API

<Callout icon="🚧" theme="warn">
  Legacy iFrame (version 1.140 and older) and non-secure tokenization was deprecated on October 31, 2026; end of life will be December 31, 2028. See the [iFrame payment form](https://developer.spreedly.com/docs/iframe-payment-form) guide for what's changing and how to stay supported.
</Callout>

# Recache

[Update the CVV](https://developer.spreedly.com/docs/iframe-payment-form#recache-existing-payment-method) on an already tokenized credit card.

> **Note:** A credit card must be retained in your environment in order to recache its CVV

## setRecache

Configure the iFrame to operate in recache mode. When iFrame has received and displayed the existing payment method information, the `recacheReady` event will be fired.

```javascript
Spreedly.on('ready', function(){
 Spreedly.setRecache("56wyNnSmuA6CWYP7w0MiYCVIbW6" , {
   'card_type': 'visa',
   'last_four_digits': '1234'
 });
});
```

### Signature

`setRecache(token, options)`

### Arguments

| Name      | Description                                                                                                                                                             |
| :-------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`   | Token of existing payment method in Spreedly environment                                                                                                                |
| `options` | Map of display options for existing payment method. Set `card_type` to support CVV validation, and `last_four_digits` to show the last four digits in the number field. |

### Events

| Name         | Occurs                                                   |
| :----------- | :------------------------------------------------------- |
| recacheReady | When the iFrame has been properly configured for recache |

## recache

Trigger `recache` on an existing payment method. Requires that `setRecache` has already been called.

On successful `recache`, the `recache` event will be triggered. On failure, the `errors` event will be triggered.

```javascript
Spreedly.recache();
```

### Signature

`recache()`

### Events

| Name      | Occurs                                              |
| :-------- | :-------------------------------------------------- |
| `recache` | When a payment method is successfully recached      |
| `errors`  | When a payment method is not successfully tokenized |