Tokenizing a Credit Card

Tokenizing a Credit Card

Stax.js is Stax's browser-side JavaScript library. It tokenizes and sends sensitive bank and card information directly from a user's browser to Stax's servers, helping your software stay PCI compliant. When you tokenize a card, you securely store that card on file for future use.

Accepting a payment with a card is identical to tokenizing a card, but it also takes payment from the tokenized card. You can also include additional details within the call to take advantage of Level 2 processing.

shield-alt
PCI Compliant

Sensitive data never touches your servers

lock
Secure Storage

Cards are tokenized and stored securely for future use

credit-card
Level 2 Processing

Support for additional payment details

Add Stax.js to your site

  1. Add the following script tag to the head of your HTML file.
  2. <script src="https://staxjs.staxpayments.com/staxjs-captcha.js"></script>

Initialize Stax.js

keyGetting Your Web Payments Token

First, find your Web Payments Token (public key) in Stax Pay by navigating to Apps > API Keys.

Initialize your Stax.js instance with the StaxJs class using your website payments token:

Note: Passing the number and CVV into the Stax.js instance generates a secure iframe around these two fields, keeping sensitive card information from touching your servers.

var staxjs = new StaxJs("your_website_payments_token", {
  number: {
    id: "card-number", // The ID of the container for the card-number field.
    placeholder: "0000 0000 0000 0000",
    style: "height: 30px; width: 100%; font-size: 15px;",
    type: "text",
    format: "prettyFormat" // Use prettyFormat, plainFormat, or maskedFormat.
  },
  cvv: {
    id: "card-cvv", // The ID of the container for the CVV field.
    placeholder: "CVV",
    style: "height: 30px; width: 100%; font-size: 15px;",
    type: "text"
  }
});

Did this page help you?