Skip to main content

JavaScript Elements SDK

JavaScript Elements SDK

publicsquare-elements

The PublicSquare JavaScript SDK makes it easy to build secure web applications that collect cardholder data using Elements.

Get started with our guide.

Before You Begin

This SDK requires the use of a Publishable API Key. Go to your Developers section and click Reveal for your Publishable Key and copy the value.

Installation

npm install --save @publicsquare/elements-js

Initialization

import { PublicSquare } from "@publicsquare/elements-js";

// In this context PublicSquare is a class
const publicsquare = await new PublicSquare().init("<API_KEY>");
// use Elements
ParameterRequiredTypeDescription
apiKeytruestringThe Publishable API Key
If you try to to use any Elements feature before calling PublicSquare.init, or before its Promise has been fulfilled, you will get an error.