# pier-react-native-payment-form

> Payment Form library for react-native apps

Latest version **0.4.2** (published 2021-12-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install pier-react-native-payment-form
pnpm add pier-react-native-payment-form
yarn add pier-react-native-payment-form
bun add pier-react-native-payment-form
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2021-12-23 |
| First published | 2021-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 180.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Pier |
| Maintainers | pierdigital |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/pier-react-native-payment-form
- Repository: https://github.com/pier-digital/pier-react-native-payment-form
- Homepage: https://github.com/pier-digital/pier-react-native-payment-form#readme
- Issues: https://github.com/pier-digital/pier-react-native-payment-form/issues
- npm.io page: https://npm.io/package/pier-react-native-payment-form

## Dependencies (1)

- [card-validator](https://npm.io/package/card-validator.md) ^8.1.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.4.2 (latest) — 2021-12-23
- 0.4.1 — 2021-12-17
- 0.4.0 — 2021-12-13
- 0.3.0 — 2021-12-13
- 0.2.0 — 2021-11-22

## README

<p align="center">
  <a href="https://rnfirebase.io">
    <img width="140px" src="https://avatars.githubusercontent.com/u/63805937?s=200&v=4"><br/>
  </a>
  <h2 align="center">Pier's Payment Form Library</h2>
</p>

Simple, self-contained payment form component for react-native apps.

![til](./assets/example.gif)

## Installation

```sh
npm install pier-react-native-payment-form
```

or

```sh
yarn add pier-react-native-payment-form
```

## Usage

```js
import React from 'react';
import PaymentForm from 'pier-react-native-payment-form';
import { StyleSheet } from 'react-native';

const styles = StyleSheet.create({
  input: {
    borderWidth: 0,
    borderBottomWidth: 1,
  },
  errorInputStyles: {},
  formGroupStyles: {},
});

function App() {
  const [formData, setFormData] = React.useState({
    valid: false,
    number: '',
    date: '',
    cvv: '',
    name: '',
  });

  const onChange = (data) => {
    setFormData(data);
  };

  return (
    <PaymentForm
      onChange={onChange}
      inputStyles={styles.input}
      errorInputStyles={styles.errorInputStyles}
      formGroupStyles={styles.formGroupStyles}
    />
  );
}
```

### Required Properties

- `onChange`: function to handle form values

onChange will receive an object with the form's values as a parameter:

```js
{
  valid: boolean; // displays if the values are valid
  number: string; // Credit Card number
  date: string; // Expiration Date
  cvv: string; //  CVC/CVV code
  name: string; //cardholder's name
}
```

### Optional Properties

- `inputStyles`: style object for the inputs in the form
- `errorInputStyles`: style object for the error messages
- `formGroupStyles`: style object for groups of inputs

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---
_Source: https://npm.io/package/pier-react-native-payment-form · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
