{"id":13395502,"url":"https://github.com/amaroteam/react-credit-cards","last_synced_at":"2025-05-15T05:06:42.759Z","repository":{"id":39092587,"uuid":"78849211","full_name":"amaroteam/react-credit-cards","owner":"amaroteam","description":"Beautiful credit cards for your payment forms","archived":false,"fork":false,"pushed_at":"2024-01-19T11:43:33.000Z","size":4702,"stargazers_count":2609,"open_issues_count":31,"forks_count":312,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-05-15T05:06:30.768Z","etag":null,"topics":["credit-card","payment","react","react-component"],"latest_commit_sha":null,"homepage":"https://ovvwzkzry9.codesandbox.io/","language":"SCSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amaroteam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-13T12:55:03.000Z","updated_at":"2025-05-14T21:36:18.000Z","dependencies_parsed_at":"2024-06-18T11:21:03.883Z","dependency_job_id":"64f0bc6d-c189-46c6-a5e7-880d7439ff7a","html_url":"https://github.com/amaroteam/react-credit-cards","commit_stats":{"total_commits":102,"total_committers":8,"mean_commits":12.75,"dds":"0.23529411764705888","last_synced_commit":"218a7ebbb568d11fb9dbed5d53bba745a534380f"},"previous_names":["amarofashion/react-credit-cards"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaroteam%2Freact-credit-cards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaroteam%2Freact-credit-cards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaroteam%2Freact-credit-cards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaroteam%2Freact-credit-cards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amaroteam","download_url":"https://codeload.github.com/amaroteam/react-credit-cards/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254276447,"owners_count":22043867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["credit-card","payment","react","react-component"],"created_at":"2024-07-30T17:02:02.850Z","updated_at":"2025-05-15T05:06:42.700Z","avatar_url":"https://github.com/amaroteam.png","language":"SCSS","funding_links":[],"categories":["SCSS"],"sub_categories":[],"readme":"# React Credit Cards\n\n[![NPM](https://badge.fury.io/js/react-credit-cards.svg)](https://www.npmjs.com/package/react-credit-cards) [![Travis](https://travis-ci.org/amarofashion/react-credit-cards.svg?branch=master)](https://travis-ci.org/amarofashion/react-credit-cards) [![Maintainability](https://api.codeclimate.com/v1/badges/bb0aa1a6b782c3845f6a/maintainability)](https://codeclimate.com/github/amarofashion/react-credit-cards/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/bb0aa1a6b782c3845f6a/test_coverage)](https://codeclimate.com/github/amarofashion/react-credit-cards/test_coverage)\n\nA slick credit card component for React.\n\n![demo](https://raw.githubusercontent.com/amarofashion/react-credit-cards/master/docs/media/rccs.gif)\n\n[Demo](https://amarofashion.github.io/react-credit-cards/)\n\n### Install\n\n```\nnpm install --save react-credit-cards\n```\n\n### Usage\n\n```jsx\nimport React from 'react';\nimport Cards from 'react-credit-cards';\n\nexport default class PaymentForm extends React.Component {\n  state = {\n    cvc: '',\n    expiry: '',\n    focus: '',\n    name: '',\n    number: '',\n  };\n\n  handleInputFocus = (e) =\u003e {\n    this.setState({ focus: e.target.name });\n  }\n  \n  handleInputChange = (e) =\u003e {\n    const { name, value } = e.target;\n    \n    this.setState({ [name]: value });\n  }\n  \n  render() {\n    return (\n      \u003cdiv id=\"PaymentForm\"\u003e\n        \u003cCards\n          cvc={this.state.cvc}\n          expiry={this.state.expiry}\n          focused={this.state.focus}\n          name={this.state.name}\n          number={this.state.number}\n        /\u003e\n        \u003cform\u003e\n        \t\u003cinput\n            type=\"tel\"\n            name=\"number\"\n            placeholder=\"Card Number\"\n            onChange={this.handleInputChange}\n            onFocus={this.handleInputFocus}\n          /\u003e\n          ...\n        \u003c/form\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\nDon't forget to import the `react-credit-cards/lib/styles.scss` if you are using SASS in your project.  \nOr you can import the CSS:  \n`import 'react-credit-cards/es/styles-compiled.css';`\n\n### Features\n\n- We support all credit card issuers available in [Payment](https://github.com/jessepollak/payment) plus Hipercard (a brazilian credit card).\n\n## Props\n\n- `name` {string}: Name on card. \\*\n- `number` {string|number}: Card number. \\*\n- `expiry` {string|number}: Card expiry date. `10/20` or `012017` \\*\n- `cvc` {string|number}: Card CVC/CVV. \\*\n- `focused` {string}: Focused card field. `name|number|expiry|cvc`\n- `locale` {object}: Localization text (e.g. `{ valid: 'valid thru' }`).\n- `placeholders` {object}: Placeholder text (e.g. `{ name: 'YOUR NAME HERE' }`).\n- `preview` {bool}: To use the card to show scrambled data (e.g. `**** 4567`).\n- `issuer` {string}: Set the issuer for the `preview` mode (e.g. `visa|mastercard|...`)\n- `acceptedCards` {array}: If you want to limit the accepted cards. (e.g. `['visa', 'mastercard']`\n- `callback` {func}: A callback function that will be called when the card number has changed with 2 paramaters: `type ({ issuer: 'visa', maxLength: 19 }), isValid ({boolean})`\n\n\\* _Required fields_\n\n## SCSS options\n\n**Credit Card sizing**\n\n- `$rccs-card-ratio`: Card ratio. Defaults to `1.5858`\n- `$rccs-size`: Card width. Defaults to `290px`\n\n**Credit Card fonts**\n\n- `$rccs-name-font-size`: Defaults to `17px`\n- `$rccs-name-font-family`: Defaults to `Consolas, Courier, monospace`\n- `$rccs-number-font-size`: Defaults to `17px`\n- `$rccs-number-font-family`: Defaults to `Consolas, Courier, monospace`\n- `$rccs-valid-font-size`: Defaults to `10px`\n- `$rccs-expiry-font-size`: Defaults to `16px`\n- `$rccs-expiry-font-family`: Defaults to `Consolas, Courier, monospace`\n- `$rccs-cvc-font-size`: Defaults to `14px`\n- `$rccs-cvc-font-family`: Defaults to `Consolas, Courier, monospace`\n- `$rccs-cvc-color`: Defaults to `#222`\n\n**Credit Card styling**\n\n- `$rccs-shadow`: Defaults to `0 0 20px rgba(#000, 0.2)`\n- `$rccs-light-text-color`: Card text color for dark cards. Defaults to `#fff`\n- `$rccs-dark-text-color`: Card text color for light cards. Defaults to `#555`\n- `$rccs-stripe-bg-color`: Stripe background color in the back. Defaults to `#2a1d16`\n- `$rccs-signature-background`: Signature background in the back. Defaults to `repeating-linear-gradient(0.1deg, #fff 20%, #fff 40%, #fea 40%, #fea 44%, #fff 44%)`\n- `$rccs-default-background`: Default card background. Defaults to `linear-gradient(25deg, #939393, #717171)`\n- `$rccs-unknown-background`: Unknown card background. Defaults to `linear-gradient(25deg, #999, #999)`\n- `$rccs-background-transition`: Card background transition. Defaults to `all 0.5s ease-out`\n- `$rccs-animate-background`: Card background animation. Defaults to `true`\n\n**Credit Card brands**\n\n- `$rccs-amex-background`: Defaults to `linear-gradient(25deg, #308c67, #a3f2cf)`\n- `$rccs-dankort-background`: Defaults to `linear-gradient(25deg, #ccc, #999)`\n- `$rccs-dinersclub-background`: Defaults to `linear-gradient(25deg, #fff, #eee)`\n- `$rccs-discover-background`: Defaults to `linear-gradient(25deg, #fff, #eee)`\n- `$rccs-mastercard-background`: Defaults to `linear-gradient(25deg, #e8e9e5, #fbfbfb)`\n- `$rccs-visa-background`: Defaults to `linear-gradient(25deg, #0f509e, #1399cd)`\n- `$rccs-elo-background`: Defaults to `linear-gradient(25deg, #211c18, #aaa7a2)`\n- `$rccs-hipercard-background`: Defaults to `linear-gradient(25deg, #8b181b, #de1f27)`\n\n## Development\n\nHere's how you can get started developing locally:\n\n    $ git clone https://github.com/amarofashion/react-credit-cards.git\n    $ cd react-credit-cards\n    $ npm install\n    $ npm start\n\nNow, if you go to `http://localhost:3000` in your browser, you should see the demo page.\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process of contributing to the project.\n\n## Useful links\n\n[EBANK's test numbers](https://www.ebanx.com/business/en/developers/integrations/testing/credit-card-test-numbers)  \n[Adyen's test numbers](https://gist.github.com/j3j5/8b3e48ccad746b90a54a)  \n[Worldpay's test card numbers](https://support.worldpay.com/support/kb/bg/testandgolive/tgl5103.html)  \n[Brazilian cards patterns](https://github.com/erikhenrique/bin-cc/blob/master/README.md)\n\n## LICENSE\n\nThis project is licensed under the [MIT License](LICENSE.md).\n\n###### Made with ❤️ at [AMARO](https://amaro.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famaroteam%2Freact-credit-cards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famaroteam%2Freact-credit-cards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famaroteam%2Freact-credit-cards/lists"}