Title

Home

SwitchPayJS library is a set of predefined blocks for collecting and validating card information.

Set up SwitchPayJS

Include switchpay.js on your checkout page by adding it to the head of your HTML file. Always load switchpay.js directly from https://js.switchpay.cc/v1/switchpay.js Don’t host this library yourself.

<head>
  <title>Checkout Page</title>
  <script src="https://js.switchpay.cc/v1/switchpay.js"></script>
</head>

Then, you need to create an instance of SwitchPay class on your checkout page.

// As parameter you have to pass: public token.
var switchPay = new SwitchPay("pk_test_72697c9a2f8d...");