JavaScript Elements SDK
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
- yarn
npm install --save @publicsquare/elements-js
yarn add @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
Parameter | Required | Type | Description |
---|---|---|---|
apiKey | true | string | The 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.