Guides
Collect Credit Cards with Inputs
If you’ve ever worked with payment card information, you’ll know that the greatest challenge is meeting the strict compliance requirements that apply to its collection, storage and use.
Evervault Inputs are easy to integrate premade UI components that allow you to be fully compliant just by meeting SAQ A requirements.
Evervault Inputs is available in our client-side SDKs. Card details encrypted with Inputs can be processed or shared with third parties using Functions, Cages or Outbound Relay.
Getting Started
Adding Inputs to a React application can be done in fewer than 10 lines of code. To get started with Inputs, you will need:
- An Evervault account (You can signup here)
- An Evervault app API key. (You can create one in your app settings page)
- The latest version of node.js
As with all Evervault encrypted data, the card details you encrypt with Inputs will only be usable by other Evervault products within the same app — so make sure that you use the right API Key by checking the App name under the App overview.
Creating a Demo App with React
For this guide, you will install Evervault Inputs in a React application.
To create a React app and install the Evervault SDK, run the following commands:
To start your app run the following command:
You should now be able to view the demo app by navigating to http://localhost:3000 in your web browser.
Setting up Evervault React SDK
First, you need to initialize the <EvervaultProvider>
JSX component with your Evervault App and Team ID. This setup allows child components to use any of the Evervault React SDK functionality.
In the demo app, you'll add the <EvervaultProvider>
to src/index.js
Your src/index.js
should look something like the following:
Using Evervault Inputs
Inputs is a JSX component that accepts an onChange
prop and an optional config
prop for styling. In this example, you will log the encrypted card number to the browser’s console. In a real-world application, you would likely store the encrypted data and then use it with either Functions, Cages or Outbound Relay to validate and/or share the cardholder data.
To use it in the demo app, add the <EvervaultInput>
component to src/App.js
by copying and pasting the code below.
Changing the style of your Inputs widget
Inputs also features full support for custom styling through the optional config
parameter. To see a full list of the available style options, view the React SDK reference here. Below is an example of custom style configuration on the <EvervaultInput>
component:
What’s Next?
Now that you have encrypted card data, what’s next?
Using Evervault, you can process or share the encrypted data. You could use a Function or a Cage to return the last 4 digits of the card number, or you could use Outbound Relay to send the encrypted data to a payments processor, and have it decrypted in-flight so that they receive the card details in plaintext.