Skip to main content

Web Elements

Web Elements

web-elements

The Basis Theory Web elements makes it easy to build secure web applications that collect or reveal sensitive data using Elements.

Get started with our guide, explore our examples, or continue reading the reference docs.

Before You Begin

This SDK requires the use of an API Key associated with a Public Application, which only allows token:create or token:update permissions to mitigate the risk that these API keys may be publicly exposed within your frontend applications.

To create one, login into our Portal and create a new "Public" Application with the permissions you require.

Considerations

Basis Theory Web Elements SDK uses conventional camel case for most methods and converts these properties to snake case when sending requests to the API. One notable exception to this is the Tokenize method which uses snake case for the request body.

Installation

To install web elements you can choose either our ES module or CDN hosted bundle through a script tag.

npm install --save @basis-theory/web-elements

Initialization

import { basistheory } from "@basis-theory/web-elements";

const bt = await basistheory("<PUBLIC_API_KEY>")
// use Elements
ParameterRequiredTypeDescription
apiKeytruestringThe API Key used to identify an Application.
Elements are meant to be used in browser environments only. If you installed web-elements as a module, make sure the instance that loads elements runs on the browser-side code.