Shift4.js is a browser-side JavaScript library that can be used to securely collect sensitive payment information (like credit card numbers).
This documentation describes every object and method made available by the library.
Shift4.js should be included on every page of your site where payment information will be collected. It should never be bundled or hosted on your website, but should always be loaded directly from https://js.dev.shift4.com.
<script type="text/javascript" src="https://js.dev.shift4.com/shift4.js"></script>To get started with Shift4.js, first, call the Shift4() method to create and configure a Shift4 object.
Create a new Shift4 object and configure it.
publicKey | string
Public API key used to identify your account. Your account is identified by a public API key. Once logged in, you can find your API keys in your account settings.
options | object, optional
Additional initialization options.
merchantId(string, optional) - identifier of the merchant. Useful especially in the context of platform setups.
var shift4 =
Shift4("pu_test_WVMFC9GFuvm54b0uorifKkCh");- Shift4 object -- the main entry point to all Shift4.js functionality.
- Components -- collect card details in one field or several.
- Styling -- customize how components look.