Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@stripe/terminal-js
Advanced tools
Use the Terminal JS SDK as an ES module.
Note: This package dynamically loads the Stripe Terminal SDK from
https://js.stripe.com
and wraps the SDK's globalStripeTerminal
function. To
be
PCI compliant,
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.
Use npm
or yarn
to install the Terminal JS module:
> npm install @stripe/terminal-js
> yarn add @stripe/terminal-js
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
.
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 or follow our getting started guide.
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. The type declarations in
@stripe/terminal-js
for these objects in currently track to
version 2018-08-23 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 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.
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 @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.
import '@stripe/terminal-js';
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.
<!-- Somewhere in your site's <head> -->
<script src="https://js.stripe.com/terminal/v1/" async></script>
loadStripeTerminal
without side effectsIf 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
FAQs
Stripe Terminal loading utility
We found that @stripe/terminal-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.