Javascript API Reference

This is the API reference for the Javascript API tokenization library. You can use our Javascript API tokenization library to collect and submit the customer’s payment information from the browser using Javascript.

For more information and examples, see Using the Javascript API.


The class on which you call the library's static methods.

(static) setEnvironment(env)

Sets the PaymentsOS environment (test or live) against which the CVV form will be initialized.
Name Type Description
env string The PaymentsOS environment. Either test or live.

(static) setPublicKey(key)

Authenticates the library using your public key.
Name Type Description
key string The public key belonging to your business unit in either your test or live environment.

(static) tokenize(data, callback)

Returns a token representation of the card information.
Name Type Description
data object The attributes required by the Create Token API.
callback function A callback function. The function must take a single parameter through which the token is returned.
    "token_type": "credit_card",
    "holder_name": "MR C D HOLDER",
    "expiration_date": "09-2019",
    "card_number": "4111111111111111"
function (result) {
    // Grab the token here
Last modified January 6, 2022