Collect.js
Collect.js is a browser‑based tokenisation library. It displays a pop‑up form hosted on the gateway, collects payment data and returns a token that you use in place of card numbers. By outsourcing data collection to the gateway, you keep sensitive details off your servers and minimise PCI scope.
Overview
The Collect.js library works by injecting a small script into your checkout page. When triggered, it opens a secure pop‑up hosted on the gateway. Customers enter their payment details directly in this pop‑up. Once submitted, the gateway returns a one‑time token which represents the card or bank details.
How It Works
To integrate Collect.js:
- Include the Collect.js library on your checkout page and configure it with your public API key. Only public keys are used client‑side, so your secret credentials remain hidden.
- Add a button or event handler that triggers the tokenisation popup. You can customise the popup’s styling to match your brand.
- When the customer submits their details, Collect.js returns a token to your callback function. Send this token to your server and use it with the Payment API to complete the transaction.
Benefits
Collect.js replaces raw card or bank account data with tokens. Because the popup form is hosted by the gateway, no payment information flows through your environment. This drastically reduces your PCI compliance footprint without sacrificing control over the checkout experience. You can still brand the popup and maintain a seamless flow.
