Braintree Node library
The Braintree Node library provides integration access to the Braintree Gateway.
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.
npm install braintree
var braintree = require('braintree')
- node >= 4
var braintree = ;// previously, gateways were created by calling `braintree.connect`, but as no// connection takes place in the method call, we've opted to document how// to instantiate a Braintree Gateway directly. `connect` can still be used,// but it is deprecated and will be removed in the next major versionvar gateway =environment: braintreeEnvironmentSandboxmerchantId: 'your_merchant_id'publicKey: 'your_public_key'privateKey: 'your_private_key';gatewaytransaction;
You can also use Promises instead of callbacks.
var braintree = ;var gateway =environment: braintreeEnvironmentSandboxmerchantId: 'your_merchant_id'publicKey: 'your_public_key'privateKey: 'your_private_key';gatewaytransaction;
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.
Dockerfile will build an image containing the dependencies and drop you to a terminal where you can run 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 (
See the LICENSE file.