# cardinityjsnode

> API wrapper for the Cardinity Payments API

Latest version **1.0.6** (published 2020-01-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install cardinityjsnode
pnpm add cardinityjsnode
yarn add cardinityjsnode
bun add cardinityjsnode
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2020-01-29 |
| First published | 2020-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sanna Jammeh |
| Maintainers | chiefkoshi |
| Keywords | Cardinity |

## Links

- npm: https://www.npmjs.com/package/cardinityjsnode
- Repository: https://github.com/ChiefKoshi/cardinityjs
- Homepage: https://github.com/ChiefKoshi/cardinityjs#readme
- Issues: https://github.com/ChiefKoshi/cardinityjs/issues
- npm.io page: https://npm.io/package/cardinityjsnode

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.19.2
- [oauth-1.0a](https://npm.io/package/oauth-1.0a.md) ^2.2.6

## Recent versions

- 1.0.6 (latest) — 2020-01-29
- 1.0.5 — 2020-01-29
- 1.0.4 — 2020-01-29
- 1.0.3 — 2020-01-29
- 1.0.2 — 2020-01-29
- 1.0.1 — 2020-01-28
- 1.0.0 — 2020-01-28

## README

# Cardinity JS Node

This is a NodeJS client library wrapper for [Cardinity's](https://developers.cardinity.com/api/v1/#introduction) payment processing API.

## Installation

    npm install cardinityjsnode

## Usage

### Create new payment

```javascript
const Cardinity = require('cardinityjsnode');
const client = new Cardinity('consumerKey', 'secretKey');

const payment = {
	amount:  '140.00',
	currency:  'USD',
	country:  'US',
	payment_method: 'card', //Not required ('card' is default).
 	payment_instrument: {
		pan:  '4111111111111111',
		exp_month:  '01',
		exp_year:  '2020',
		cvc:  '123',
		holder:  'John Doe',
	},
};

client.createPayment(payment).then(response => {
	//Handle response
}).catch(error => {
	//Handle error
});
```

Field payment_method is not required as 'card' is default value. For a recurring payment use `payment_method: 'recurring'` and `payment_instrument: "{UUID}"`

### Get existing payment('s)

```javascript
const Cardinity = require('cardinityjsnode');
const client = new Cardinity('consumerKey', 'secretKey');

client.getPayments('{UUID}').then(response => {
    //Handle response
}).catch(error => {
    //Handle error
});
```

Method getPayments() can be called without arguments and will return all payments based on the default limit of Cardinity's API.

### Methods

-   `createPayment(fields)` | Returns a payment object upon success, returns error object upon error. Can also return payment error object
-   `getPayments(id)` Returns all payments or single payment if ID is included. Returns error object upon error.
-   `finalize({authorize_data, id})` | Returns a payment object upon successful 3D Secure finalization. Returns error object upon error. Can also return payment error object upon 3D Secure denial.

All responses are raw (json parsed by axios) from the Cardinity API, no data is changed.

## API Docmumentation

[https://developers.cardinity.com/api/v1/](https://developers.cardinity.com/api/v1/)

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