# 2co-react

> React stateful component to connect to 2CO api and generate authorization token

Latest version **0.1.6** (published 2018-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install 2co-react
pnpm add 2co-react
yarn add 2co-react
bun add 2co-react
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2018-11-23 |
| First published | 2018-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 67.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Matan Schatzman |
| Maintainers | metalice |
| Keywords | 2checkout, 2co, payment, payment gateway, react |

## Links

- npm: https://www.npmjs.com/package/2co-react
- Repository: https://github.com/metalice/2CO-NODE
- Issues: https://github.com/metalice/2CO-NODE/issues
- npm.io page: https://npm.io/package/2co-react

## Dependencies (7)

- [react](https://npm.io/package/react.md) ^16.6.3
- [react-dom](https://npm.io/package/react-dom.md) ^16.6.3
- [card-react](https://npm.io/package/card-react.md) ^1.2.7
- [react-form](https://npm.io/package/react-form.md) ^3.5.6
- [react-load-script](https://npm.io/package/react-load-script.md) ^0.0.6
- [react-loader-spinner](https://npm.io/package/react-loader-spinner.md) ^2.2.0
- [react-responsive-modal](https://npm.io/package/react-responsive-modal.md) ^3.5.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.6 (latest) — 2018-11-23
- 0.1.5 — 2018-11-23
- 0.1.4 — 2018-11-23
- 0.1.3 — 2018-11-22
- 0.1.2 — 2018-11-22
- 0.1.1 — 2018-11-22
- 0.1.0 — 2018-11-22

## README

# 2Checkout payment gateway and react 

React stateful component with or without credit form that connect to 2CO api and generate client token

## Getting Started

2Checkout payment gateway need a token to create and charge orders.
This package will create a token for you.

Using this token, you will need to send your order and customer info to 2Checkout to make the charge.

This can be done by [2Checkout API](https://www.2checkout.com/documentation/payment-api/create-sale) or by [2Checkout-Node](https://www.npmjs.com/package/2checkout-node).

I recommend using [2Checkout-Node](https://www.npmjs.com/package/2checkout-node) along with this package to generate token and send it to [2Checkout-Node](https://www.npmjs.com/package/2checkout-node) to create the charge.


### Installing & Usage

A step by step series of examples that tell you how to get a token:

#### Install:

```
npm i 2co-react
```
` or `
```
yarn add 2co-react
```
#### Usage: 

Importing:

```Javascript
import TCO from '2co-react';
```
This is the only component you need to add:
```Javascript
        <TCO
          sellerId="xxxxx"
          publishableKey="xxxxx"
          sandbox
          showForm
          showModal
          showLoading
          returnToken={this.returnToken}
        />
```        

#### Props Options:

| TCO Prop      | VALUE         | Effect |
| ------------- |:-------------:| -----:|
| sellerId     | selled id from 2checkout account| - |
| publishableKey     | publishable key from 2checkout account      |   - |
| sandbox | true or false   |    generate a sandbox or production token |
| showForm | true or false      |    show cedit card form |
| showModal | true or false       |    show credit card form on modal or on page |
| showLoading| true or false     |    show loading bar while waiting for response back |
| returnToken| function     |    function that will recive one argument as the token string |



## Authors

* **Matan Schatzman** - [Email](mailto:matanschatzman@gmail.com)

## License

This project is licensed under the MIT License

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