# braintree-as-promised

> Add native promises to braintree gateway

Latest version **1.0.0** (published 2017-03-27) · 0 weekly downloads

## Install

```sh
npm install braintree-as-promised
pnpm add braintree-as-promised
yarn add braintree-as-promised
bun add braintree-as-promised
```

## 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.0 |
| Published | 2017-03-27 |
| First published | 2016-04-08 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 5.0.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Ivan Kerin |
| Maintainers | ikerin |

## Links

- npm: https://www.npmjs.com/package/braintree-as-promised
- Repository: https://github.com/enhancv/braintree-as-promised
- Issues: https://github.com/enhancv/braintree-as-promised/issues
- npm.io page: https://npm.io/package/braintree-as-promised

## Recent versions

- 1.0.0 (latest) — 2017-03-27
- 0.4.0 — 2016-11-01
- 0.3.2 — 2016-09-02
- 0.3.1 — 2016-06-03
- 0.3.0 — 2016-06-02
- 0.2.0 — 2016-04-08
- 0.1.0 — 2016-04-08

## README

# braintree-as-promised
[![Build Status](https://travis-ci.org/enhancv/braintree-as-promised.svg?branch=master)](https://travis-ci.org/enhancv/braintree-as-promised)
[![Code Climate](https://codeclimate.com/github/enhancv/braintree-as-promised/badges/gpa.svg)](https://codeclimate.com/github/enhancv/braintree-as-promised)
[![Test Coverage](https://codeclimate.com/github/enhancv/braintree-as-promised/badges/coverage.svg)](https://codeclimate.com/github/enhancv/braintree-as-promised/coverage)

Add native promises to braintree gateway

## Getting Started
Install the module with: `npm install braintree-as-promised`

```javascript
var braintree = require('braintree');
var promised = require('braintree-as-promised');
var gateway = promised(braintree.connect({ ... }));

gateway.clientToken
    .generate({})
    .then((result) => {
        console.log(result.clientToken);
    });

gateway.transaction
    .sale({
        ...
    })
    .then((result) => {
        console.log(result.transaction);
    });
```

## Documentation

calling `promised(gateway)` will return a new gateway object with all the methods converted to promise-based ones, using native promises. You can continue to use your gateway object normal, as it does not change anything on the original object.

Additionally it handles the "result.success" parameter, so that if success === false, the promise is rejected with the returned error message.

## License
Copyright (c) 2016 Enhancv
Licensed under the MIT license.

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