All Projects â†’ pagarme â†’ React Payment Card Component

pagarme / React Payment Card Component

Licence: mit
💳 A modern credit card component for React

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Payment Card Component

React Nouislider
React wrapper on NoUiSlider
Stars: ✭ 41 (-44.59%)
Mutual labels:  react-component
React Router Form
<Form> is to <form> as <Link> is to <a>
Stars: ✭ 58 (-21.62%)
Mutual labels:  react-component
React Hover
React hover --- make hover easy http://cht8687.github.io/react-hover/example/
Stars: ✭ 64 (-13.51%)
Mutual labels:  react-component
React Sane Contenteditable
React component with sane defaults to make any element contentEditable
Stars: ✭ 45 (-39.19%)
Mutual labels:  react-component
React Stonecutter
Animated grid layout component for React
Stars: ✭ 1,089 (+1371.62%)
Mutual labels:  react-component
React Filtered Multiselect
Filtered multi-select React component
Stars: ✭ 61 (-17.57%)
Mutual labels:  react-component
Spicy Datatable
React.js datatables without jQuery. Smart react datatable that includes search, pagination and localization.
Stars: ✭ 36 (-51.35%)
Mutual labels:  react-component
Yandex Map React
Stars: ✭ 67 (-9.46%)
Mutual labels:  react-component
React Topbar Progress Indicator
`topbar` progress indicator as a React component
Stars: ✭ 58 (-21.62%)
Mutual labels:  react-component
React Console
Simple react console emulator
Stars: ✭ 64 (-13.51%)
Mutual labels:  react-component
React Echarts V3
React.js(v16.x+) component wrap for ECharts.js(v3.x+)
Stars: ✭ 48 (-35.14%)
Mutual labels:  react-component
React Contenteditable
React component for a div with editable contents
Stars: ✭ 1,057 (+1328.38%)
Mutual labels:  react-component
React Xmasonry
Simple, minimalistic and featured native masonry layout for React JS.
Stars: ✭ 62 (-16.22%)
Mutual labels:  react-component
React For Electron Only
React component for rendering component for Electron based clients only
Stars: ✭ 45 (-39.19%)
Mutual labels:  react-component
React Lottie
Render After Effects animations on React based on lottie-web
Stars: ✭ 1,132 (+1429.73%)
Mutual labels:  react-component
Reimgix
🌇 Get all the benefits of Imgix using React. Supports LQIP.
Stars: ✭ 39 (-47.3%)
Mutual labels:  react-component
React No Content
A SVG react component to display when there's no content.
Stars: ✭ 59 (-20.27%)
Mutual labels:  react-component
React Marquee Slider
The marquee slider of your deepest dreams. Only for React.js ⛺
Stars: ✭ 73 (-1.35%)
Mutual labels:  react-component
React Router Ga
Google Analytics component for React Router
Stars: ✭ 66 (-10.81%)
Mutual labels:  react-component
React Bps
🔱 Create breakpoints to your component props
Stars: ✭ 64 (-13.51%)
Mutual labels:  react-component

React Payment Card Component | GitHub license Travis CI Status

A modern credit card component for React

React Payment Card Component

This React component will help you building your checkout on your e-commerce.

The first version of a payment card modal was used in Pagar.me's checkout 1.0, but as we're now rewriting it to version 2.0 in React, why not creating a component so people also can use it the way they prefer?

By having a lot of credit cards from many different banks, brands and types, users will be able to see a digital version of their credit cards as they type the credit card number.

Check it live at https://pagarme.github.io/react-payment-card-component

Usage

To use this component in your React app, start by adding it to the project dependencies list:

npm version > 5

npm i react-payment-card-component

npm version < 5

npm i react-payment-card-component --save

yarn

yarn add react-payment-card-component

And then, import it:

import PaymentCard from 'react-payment-card-component'

render () {
  return (
    <PaymentCard
      bank="itau"
      model="personnalite"
      type="black"
      brand="mastercard"
      number="4111111111111111"
      cvv="202"
      holderName="Owen Lars"
      expiration="12/20"
      flipped={false}
    />
  );
}

Flipping the card

You can use React to manage the card state and implement your own logic, like flipping the card with a button or when user is typing the CVV (Card Verification Value).

flipCard () {
  const flipped = !this.state.flipped
  this.setState({ flipped })
}

Available Props

Name Type Required Description
bank String true The bank prop defines the major style for the card, like the elements positions, background color and logos. Examples.: default, itau, santander, nubank
model String false Model refers to the card model. Examples.: normal, prime, personnalite
type String false (although it's not required, some styles may not properly work without it) The type is used alongside with bank and model to get the final card styling. They are the types of a credit card that each bank can emit. Examples.: gold, black, platinum
brand String true This prop is used to get the correct logo and position of the brand used in the card. Examples: mastercard, visa.
number String false The card number printed in the card
cvv String false 3-digit CVV (Card Verification Value)
holderName String false The holder name as printed in the card
expiration String false The expiration month and year following the pattern: MM/YY
flipped Boolean false If true the backface of the card will be shown

Customizing

Styling

The CSS files to manage the banks styles are under ./src/components/PaymentCard/styles, where each bank needs its own file under the banks folder and have it imported in the main ./src/components/PaymentCard/styles/index.css file.

To add a new style, remember to create classes following the pattern: bankName-cardModel-cardType:

.santander-normal-black {
  background: #000000;
}

Logos

We currently have 3 types of logos:

  • bankLogo
  • brandLogo
  • modelLogo

If you need to add new assets for corresponding logos, do it under the proper component folder in the images folder.

Guidelines

  • Prefer .svg files or .png (in that order)
  • Keep them as small as possible, even if they are going to be compressed in the build process

Contributing

We're always happy with contributors helping us evolving this project, so feel free to warn us about any bugs you found, new features you think might be cool for the project and also by adding new banks so we can have a lot of different credit cards.

Start by reading our Contributing guide and checking our Issues page.

License

This project is licensed under MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].