# @stripe/terminal-js

> Stripe Terminal loading utility

Latest version **0.26.0** (published 2025-11-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stripe/terminal-js
pnpm add @stripe/terminal-js
yarn add @stripe/terminal-js
bun add @stripe/terminal-js
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.26.0 |
| Published | 2025-11-04 |
| First published | 2020-05-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 68.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Stripe |
| Maintainers | nazli-stripe, stripejs, jordand-stripe, arashn-stripe, maxliu-stripe, hideokamoto-stripe, jackieosborn-stripe, billfinn-stripe, lins-stripe, stripe-bindings, jil-stripe, tomas-stripe, graceg-stripe, bibek-stripe, rado-stripe, yuluomeng, cyuen-stripe, fkuo-stripe, tomasf-stripe, chaves-stripe, porter-stripe, lemuel-stripe, ngrubb-stripe, cchalstrom-stripe, charliecruzan-stripe, mattpatt-stripe, ericfrank-stripe, tomer-stripe, mindy-stripe, tennhard-stripe, jackokerman-stripe, ianjabour-stripe, stegs-stripe, jeremyg-stripe, ebarrenechea-stripe, stevekaliski-stripe, matebek-stripe, henryx-stripe, kovalev-stripe, aaronhernandez-stripe, aywang-stripe, timbennett-stripe, davidme-stripe, kentwilliams-stripe, svenugopal-stripe, alexander-stripe, toluo-stripe, tillh-stripe, wooj-stripe, carlosmuvi, joyceqin-stripe, jaynewstrom-stripe, gbirch-stripe, cttsai, luisv-stripe, lamflam-stripe, tjclawson-stripe, matv-stripe, tianzhao-stripe, lng-stripe, mats-stripe, samer-stripe |
| Keywords | Stripe, Terminal, Terminal.js |

## Links

- npm: https://www.npmjs.com/package/@stripe/terminal-js
- Homepage: https://stripe.com/docs/terminal/sdk/js
- npm.io page: https://npm.io/package/@stripe/terminal-js

## Dependencies (2)

- [ws](https://npm.io/package/ws.md) 6.2.3
- [stripe](https://npm.io/package/stripe.md) ^8.222.0

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.26.0 (latest) — 2025-11-04
- 0.25.0 — 2025-10-09
- 0.24.0 — 2025-06-03
- 0.23.0 — 2025-02-03
- 0.19.0 — 2024-11-04
- 0.22.0 — 2024-11-04
- 0.21.0 — 2024-11-04
- 0.20.0 — 2024-11-04
- 0.18.0 — 2024-09-19
- 0.13.0 — 2024-04-29
- 0.12.0 — 2023-07-28
- 0.11.2 — 2022-11-11
- 0.11.0 — 2022-09-13
- 0.10.1 — 2022-06-03
- 0.9.1 — 2022-06-03
- … 12 more at https://npm.io/package/@stripe/terminal-js/versions

## README

# Terminal JS ES Module

Use the [Terminal JS SDK](https://stripe.com/docs/terminal/sdk/js) as an ES
module.

**Note**: This package dynamically loads the Stripe Terminal SDK from
`https://js.stripe.com` and wraps the SDK's global`StripeTerminal` function. To
be
[PCI compliant](https://stripe.com/docs/security/guide#validating-pci-compliance),
you must load the SDK directly from `https://js.stripe.com` by using this
library. You cannot include the dynamically loaded code in a bundle or host it
yourself.

[![npm version](https://img.shields.io/npm/v/@stripe/terminal-js.svg?style=flat-square)](https://www.npmjs.com/package/@stripe/terminal-js)

## Installation

Use `npm` or `yarn` to install the Terminal JS module:

```sh
> npm install @stripe/terminal-js

> yarn add @stripe/terminal-js
```

## Usage

### `loadStripeTerminal`

This function returns a `Promise` that resolves with a newly created
`StripeTerminal` object once the Terminal JS SDK has loaded. If necessary, it
will load the SDK for you by inserting the Terminal JS script tag. If you call
`loadStripeTerminal` in a server environment it will resolve to `null`.

```js
import {loadStripeTerminal} from '@stripe/terminal-js';

const StripeTerminal = await loadStripeTerminal();

const terminal = StripeTerminal.create({
  onFetchConnectionToken: async () => {
    …
  }
})
```

For more information on how to use the Terminal JS SDK once it loads, please
refer to the
[Terminal JS SDK API reference](https://stripe.com/docs/terminal/js-api-reference)
or follow our [getting started](https://stripe.com/docs/terminal/sdk/js) guide.

## TypeScript support

This package includes TypeScript declarations for the Terminal JS SDK. We
support projects using TypeScript versions >= 3.1.

Some methods in Terminal JS SDK accept and return objects from the
[Stripe API](https://stripe.com/docs/api). The type declarations in
`@stripe/terminal-js` for these objects in currently track to
[version 2018-08-23](https://stripe.com/docs/api/versioning) of the Stripe API.
If you have code using other versions of the Stripe API you may have to override
type definitions as necessary.

Note that we may release new [minor and patch](https://semver.org/) versions of
`@stripe/terminal-js` with small but backwards-incompatible fixes to the type
declarations. These changes will not affect the Terminal JS SDK itself.

## Ensuring the Terminal JS SDK is available everywhere

By default, this module will insert a `<script>` tag that loads the Terminal JS
SDK from `https://js.stripe.com`. This happens as a side effect immediately upon
importing this module.

### Import as a side effect

Import `@stripe/terminal-js` as a side effect in code that will be included
throughout your site (e.g. your root module). This will make sure the Terminal
JS SDk script tag is inserted immediately upon page load.

```js
import '@stripe/terminal-js';
```

### Manually include the script tag

Manually add the Stripe.js script tag to the `<head>` of each page on your site.
If an existing script tag is already present, this module will not insert a new
one. When you call `loadStripeTerminal`, it will use the existing script tag.

```html
<!-- Somewhere in your site's <head> -->
<script src="https://js.stripe.com/terminal/v1/" async></script>
```

### Importing `loadStripeTerminal` without side effects

If you would like to use `loadStripeTerminal` in your application, but defer
loading the Terminal JS SDK script until `loadStripeTerminal` is first called,
use the alternative `@stripe/terminal-js/pure` import path:

```
import {loadStripeTerminal} from '@stripe/terminal-js/pure';

// Terminal SDK will not be loaded until `loadStripeTerminal` is called
```

## Terminal JS SDK Documentation

- [Terminal JS SDK Docs](https://stripe.com/docs/terminal/sdk/js)
- [Terminal JS SDK API Reference](https://stripe.com/docs/terminal/js-api-reference)

---
_Source: https://npm.io/package/@stripe/terminal-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
