--- title: Storage description: The API for interacting with local storage. api_version: 2023-10 api_name: checkout-ui-extensions source_url: html: https://shopify.dev/docs/api/checkout-ui-extensions/2023-10/apis/storage md: https://shopify.dev/docs/api/checkout-ui-extensions/2023-10/apis/storage.md --- # StorageAPI The API for interacting with local storage. ## StandardApi The base API object provided to `purchase`, and `customer-account.order-status` extension targets. * storage Storage required Key-value storage for the extension. Uses `localStorage` and should persist across the buyer's current checkout session. However, data persistence isn't guaranteed and storage is reset when the buyer starts a new checkout. Data is shared across all activated extension targets of this extension. In versions `<=2023-07`, each activated extension target had its own storage. ### Storage A key-value storage object for the extension. Stored data is only available to this specific extension and any of its instances. The storage backend is implemented with \`localStorage\` and should persist across the buyer's checkout session. However, data persistence isn't guaranteed. * read Read and return a stored value by key. The stored data is deserialized from JSON and returned as its original primitive. Returns \`null\` if no stored data exists. ```ts (key: string) => Promise ``` * write Write stored data for this key. The data must be serializable to JSON. ```ts (key: string, data: any) => Promise ``` * delete Delete stored data by key. ```ts (key: string) => Promise ``` ```ts export interface Storage { /** * Read and return a stored value by key. * * The stored data is deserialized from JSON and returned as * its original primitive. * * Returns `null` if no stored data exists. */ read(key: string): Promise; /** * Write stored data for this key. * * The data must be serializable to JSON. */ write(key: string, data: any): Promise; /** * Delete stored data by key. */ delete(key: string): Promise; } ``` ## use​Storage() Returns the key-value `Storage` interface for the extension target. ### Returns * Storage ### Storage * read \(key: string) => Promise\ Read and return a stored value by key. The stored data is deserialized from JSON and returned as its original primitive. Returns `null` if no stored data exists. * write (key: string, data: any) => Promise\ Write stored data for this key. The data must be serializable to JSON. * delete (key: string) => Promise\ Delete stored data by key. ### Storage A key-value storage object for the extension. Stored data is only available to this specific extension and any of its instances. The storage backend is implemented with \`localStorage\` and should persist across the buyer's checkout session. However, data persistence isn't guaranteed. * read Read and return a stored value by key. The stored data is deserialized from JSON and returned as its original primitive. Returns \`null\` if no stored data exists. ```ts (key: string) => Promise ``` * write Write stored data for this key. The data must be serializable to JSON. ```ts (key: string, data: any) => Promise ``` * delete Delete stored data by key. ```ts (key: string) => Promise ``` ```ts export interface Storage { /** * Read and return a stored value by key. * * The stored data is deserialized from JSON and returned as * its original primitive. * * Returns `null` if no stored data exists. */ read(key: string): Promise; /** * Write stored data for this key. * * The data must be serializable to JSON. */ write(key: string, data: any): Promise; /** * Delete stored data by key. */ delete(key: string): Promise; } ``` ## Related [![](https://shopify.dev/images/icons/32/blocks.png)![](https://shopify.dev/images/icons/32/blocks-dark.png)](https://shopify.dev/docs/api/checkout-ui-extensions/targets) [ReferenceTargets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) [![](https://shopify.dev/images/icons/32/apps.png)![](https://shopify.dev/images/icons/32/apps-dark.png)](https://shopify.dev/docs/api/checkout-ui-extensions/components) [ReferenceComponents](https://shopify.dev/docs/api/checkout-ui-extensions/components) [![](https://shopify.dev/images/icons/32/gear.png)![](https://shopify.dev/images/icons/32/gear-dark.png)](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) [ReferenceConfiguration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) [![](https://shopify.dev/images/icons/32/tutorial.png)![](https://shopify.dev/images/icons/32/tutorial-dark.png)](https://shopify.dev/apps/checkout) [LearnTutorials](https://shopify.dev/apps/checkout)