
Description
React Payment Inputs is a React hook and container that helps you build the card number, expiry date, security code and ZIP fields of a payment form. The hook, usePaymentInputs, returns prop getter functions for each field, and you spread them onto your own inputs, so the library does not force a look on your form. It also reports the detected card type, field errors, which inputs have been touched, and which field is focused. You can supply your own validators and error messages, and callbacks for change, blur, touch and error events. A render-props version and a built-in styled wrapper are available if you want ready-made styling. The README shows how to use it with UI libraries such as Fannypack and Bootstrap, and with form libraries such as Formik and React Final Form. Custom card images are supported. It needs React 16.8 or newer, because it uses hooks. The project is public on GitHub.…
Highlights
- React hook with prop getters for each card field
- Detects card type and reports field errors
- Custom validators and error messages
- Built-in styled wrapper or your own design
- Works with Formik and React Final Form
Ratings & Reviews
No ratings yet
Be the first to rate react-payment-inputs.
People also visit
react-payment-inputs FAQ
What is React Payment Inputs?
A React hook and container for the card number, expiry date, CVC and ZIP fields of a payment form.
Does it come with styles?
Not by default. You can style the fields yourself, or use the built-in styled wrapper described in the README.
Which React version do I need?
React 16.8 or newer, because the hook version uses hooks.
Can I use it with my form library?
Yes. The README has examples for Formik and React Final Form, along with examples for Fannypack and Bootstrap.
What are the best react-payment-inputs alternatives?
Popular alternatives to react-payment-inputs include react-payment-inputs, react-credit-cards and react-credit-cards-2. See all react-payment-inputs alternatives
















