Tokenize with Runner.js
What is Runner.js?
Runner.js is a browser-side JavaScript library used to tokenize and send sensitive payment information directly from a user’s browser, keeping your customers’ data secure and your software fully PCI-compliant. A single integration to Runner.js can be used to handle tokenization for all supported Payments API products in Run Developer.
If you’d like to tokenize a payment account without integrating to Runner.js, log in to your Run Merchant test account and navigate to the Developer menu where you will find a card tokenizer for your merchant account. Please reach out to your Integration Delivery lead if you require assistance.
Requirements:
Before you can tokenize an account using Runner.js, you must have:
public_key
generated in Run Merchant or provided by your Integration Delivery Lead.
Usage
- Add the Runner.js script to your page by adding the tag to the ‘head’ of your HTML file.
- Initialize Runner.js using your
public_key
. (See Runner.js Parameters)
- (Optional) Subscribe to iframe loaded event:
- Call the
tokenize
method to generate tokenized account information that has been entered into the Runner.js field. The resulting value may then be passed to the Payment API to enact payment processing activities. (Note: This action can be completed during form submission, if preferred.)
The function within the tokenize
call will return the following data:
Runner.js Parameters
Examples
Cardpointe Gateway
Passing Merchant ID while using the same Public Key to render the correct version of the iFrame
Cybersource Gateway
If on your form there is a div like this:
Then in the init function, you should have cvvFieldSelector: '#cvvId',
Example:
Full HTML example:
When there is an error where the html element cannot be specified, check to ensure html includes form ID or credit card field identifier. The below must be present if using element: ‘#run-form’
<div id="run-form"></div>
Since cvvFieldSelector
was omitted, runner.js will use the default #securityCode-container
selector as well as the cardNumberFieldSelector
if omitted, so #cardNumber-container
selector should be used.