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.

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

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...");