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.

POS()

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.
Parameters:
Name Type Description
env string The PaymentsOS environment. Either test or live.

(static) setPublicKey(key)

Authenticates the library using your public key.
Parameters:
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.
Parameters:
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.
Example
POS.tokenize({
    "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