# node-trustcommerce

> TrustCommerce API Wrapper

Latest version **1.0.3** (published 2015-12-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-trustcommerce
pnpm add node-trustcommerce
yarn add node-trustcommerce
bun add node-trustcommerce
```

## 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.3 |
| Published | 2015-12-14 |
| First published | 2015-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Anid Monsur |
| Maintainers | ginovva320 |

## Links

- npm: https://www.npmjs.com/package/node-trustcommerce
- Repository: https://github.com/bookbottles/node-trustcommerce
- Issues: https://github.com/bookbottles/node-trustcommerce/issues
- npm.io page: https://npm.io/package/node-trustcommerce

## Dependencies (3)

- [q](https://npm.io/package/q.md) ^1.4.1
- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [request](https://npm.io/package/request.md) ^2.64.0

## Recent versions

- 1.0.3 (latest) — 2015-12-14
- 1.0.2 — 2015-10-24
- 1.0.0 — 2015-10-08
- 0.0.3 — 2015-07-25
- 0.0.2 — 2015-07-25

## README

# node-trustcommerce

[![npm version](https://badge.fury.io/js/node-trustcommerce.svg)](https://badge.fury.io/js/node-trustcommerce)
[![Build](https://travis-ci.org/bookbottles/node-trustcommerce.svg)](https://travis-ci.org/bookbottles/node-trustcommerce)
[![codecov.io](http://codecov.io/github/bookbottles/node-trustcommerce/coverage.svg?branch=master)](http://codecov.io/github/bookbottles/node-trustcommerce?branch=master)

Summary
=======
A node.js library for communicating with the [TrustCommerce](http://www.trustcommerce.com/) payment gateway. This library
returns promises.

You can install via npm:

	npm install node-trustcommerce --save


# Examples

In order to use this library, you'll need your account ID and password.

The `send()` function takes two parameters: the action, and an object of parameters to send. The action
and parameters are defined in the [TC Link API developer's guide](https://vault.trustcommerce.com/downloads/TC_Link_API_Developer_Guide.pdf).

On success, the promise will be fulfilled with an object representing the API response.

## Process a new sale

```javascript
var TCLink = require('node-trustcommerce');

var client = new TCLink('YOUR_ACCOUNT_ID', 'YOUR_PASSWORD');

client.send('sale', {
    amount: 1000,
    cc: '4111111111111111',
    exp: '0419',
    cvv: 123
}).then(function(response) {
    console.log('Successfully processed transaction #: ' + response.transid);
}, function(error) {
    console.error('Encountered error: ' + error.status);
});
```
    
## Handling Errors

If the request encountered an error, the promise will be rejected with an object containing an
`err` message, a `statusCode`, and the request `body`.

If the action itself failed on TrustCommerce's end, then the rejection error will be an object
representation of the API's response.

```javascript
client.send('sale', {
    amount: 1000
}).catch(function(error) {
    // error = {
    //   status: 'baddata',
    //   error: 'missingfields',
    //   offenders: ['cc', 'exp']
    // }
});
```

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