3.23.0 • Published 1 month ago

braintree v3.23.0

Weekly downloads
64,150
License
MIT
Repository
github
Last release
1 month ago

Braintree Node library

The Braintree Node library provides integration access to the Braintree Gateway.

Please Note

The Payment Card Industry (PCI) Council has mandated that early versions of TLS be retired from service. All organizations that handle credit card information are required to comply with this standard. As part of this obligation, Braintree is updating its services to require TLS 1.2 for all HTTPS connections. Braintree will also require HTTP/1.1 for all connections. Please see our technical documentation for more information.

Installation

  • npm install braintree
  • var braintree = require('braintree')

Dependencies

  • node >= 10

Versions

Braintree employs a deprecation policy for our SDKs. For more information on the statuses of an SDK check our developer docs.

Major version numberStatusReleasedDeprecatedUnsupported
3.x.xActiveSeptember 2020TBATBA
2.x.xInactiveFebruary 2017September 2022September 2023

Links

Updating from an Inactive, Deprecated, or Unsupported version of this SDK? Check our Migration Guide for tips.

Quick Start

var braintree = require("braintree");

var gateway = new braintree.BraintreeGateway({
  environment: braintree.Environment.Sandbox,
  merchantId: "your_merchant_id",
  publicKey: "your_public_key",
  privateKey: "your_private_key",
});

gateway.transaction.sale(
  {
    amount: "5.00",
    paymentMethodNonce: "nonce-from-the-client",
    options: {
      submitForSettlement: true,
    },
  },
  function (err, result) {
    if (err) {
      console.error(err);
      return;
    }

    if (result.success) {
      console.log("Transaction ID: " + result.transaction.id);
    } else {
      console.error(result.message);
    }
  }
);

Promises

You can also use Promises instead of callbacks.

var braintree = require("braintree");

var gateway = new braintree.BraintreeGateway({
  environment: braintree.Environment.Sandbox,
  merchantId: "your_merchant_id",
  publicKey: "your_public_key",
  privateKey: "your_private_key",
});

gateway.transaction
  .sale({
    amount: "5.00",
    paymentMethodNonce: "nonce-from-the-client",
    options: {
      submitForSettlement: true,
    },
  })
  .then(function (result) {
    if (result.success) {
      console.log("Transaction ID: " + result.transaction.id);
    } else {
      console.error(result.message);
    }
  })
  .catch(function (err) {
    console.error(err);
  });

Almost all methods that uses a callback can alternatively use a Promise. The only exceptions are gateway.merchantAccount.all or any of the search methods because they return a stream if no callback is provided.

Documentation

Developing (Docker)

The Makefile and Dockerfile will build an image containing the dependencies and drop you to a terminal where you can run tests.

make

Tests

The unit specs can be run by anyone on any system, but the integration specs are meant to be run against a local development server of our gateway code. These integration specs are not meant for public consumption and will likely fail if run on your system. To run unit tests use rake (rake test:unit) or npm (npm test).

License

See the LICENSE file.

3.23.0

1 month ago

3.22.0

2 months ago

3.21.0

4 months ago

3.20.0

4 months ago

3.17.0

8 months ago

3.18.0

7 months ago

3.19.0

6 months ago

3.16.0

11 months ago

3.14.0

1 year ago

3.15.0

1 year ago

3.13.0

1 year ago

3.12.0

2 years ago

3.11.0

2 years ago

3.9.0

2 years ago

3.10.0

2 years ago

3.8.0

2 years ago

3.7.0

3 years ago

3.6.0

3 years ago

3.5.0

3 years ago

3.4.0

3 years ago

3.3.0

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.0

4 years ago

2.24.0

4 years ago

2.23.0

4 years ago

2.22.0

4 years ago

2.21.0

5 years ago

2.20.0

5 years ago

2.19.0

5 years ago

2.18.0

5 years ago

2.17.0

5 years ago

2.16.0

5 years ago

2.15.0

5 years ago

2.14.0

5 years ago

2.13.1

6 years ago

2.13.0

6 years ago

2.12.0

6 years ago

2.11.0

6 years ago

2.10.0

6 years ago

2.9.0

6 years ago

2.8.0

6 years ago

2.7.0

6 years ago

2.6.0

6 years ago

2.5.0

6 years ago

2.4.0

6 years ago

2.3.0

7 years ago

2.2.0

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.2

7 years ago

1.47.1

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.47.0

7 years ago

1.46.0

7 years ago

1.45.0

7 years ago

1.44.0

7 years ago

1.43.0

7 years ago

1.42.0

8 years ago

1.41.0

8 years ago

1.40.0

8 years ago

1.39.0

8 years ago

1.38.0

8 years ago

1.37.1

8 years ago

1.37.0

8 years ago

1.36.0

8 years ago

1.35.1

8 years ago

1.35.0

8 years ago

1.34.0

8 years ago

1.32.0

8 years ago

2.17.2

8 years ago

1.31.0

8 years ago

1.30.0

9 years ago

1.29.0

9 years ago

1.28.0

9 years ago

1.27.0

9 years ago

1.26.0

9 years ago

1.25.0

9 years ago

1.24.0

9 years ago

1.23.0

9 years ago

1.22.0

9 years ago

1.21.0

9 years ago

1.20.0

10 years ago

1.19.0

10 years ago

1.18.1

10 years ago

1.18.0

10 years ago

1.17.0

10 years ago

1.16.0

10 years ago

1.15.0

10 years ago

1.14.1

10 years ago

1.14.0

10 years ago

1.13.1

10 years ago

1.13.0

10 years ago

1.12.0

10 years ago

1.11.2

10 years ago

1.11.1

10 years ago

1.11.0

10 years ago

1.10.0

10 years ago

1.9.2

10 years ago

1.9.1

11 years ago

1.9.0

11 years ago

1.8.0

11 years ago

1.7.0

11 years ago

1.6.0

11 years ago

1.5.1

11 years ago

1.4.0

12 years ago

1.3.0

12 years ago

1.2.0

12 years ago

1.1.2

12 years ago

1.1.1

12 years ago

1.1.0

12 years ago

1.0.0

12 years ago

0.5.1

12 years ago

0.5.0

12 years ago

1.0.105

12 years ago

0.4.1

12 years ago

0.4.0

13 years ago

0.3.0

13 years ago

0.2.0

13 years ago

0.1.1

13 years ago