adonis-braintree

1.0.5 • Public • Published

Adonis Braintree Provider

A Braintree provider for the adonis framework.

Use this library to access the gateway object from within Adonis

Install

npm install --save adonis-braintree

Configure

Register it in bootstrap/app.js:

const providers = [
  ...
  'adonis-braintree/providers/BraintreeGatewayProvider'
]

You may also want to register an alias:

const aliases = {
  ...
  BraintreeGateway: 'Adonis/Addons/BraintreeGateway'
}

Create a configuration file in config/braintree.js. For example:

'use strict';

const Env = use('Env');

module.exports = {
  environment: 'sandbox',
  merchantId: Env.get('BRAINTREE_MERCHANTID'),
  publicKey: Env.get('BRAINTREE_KEY_PUBLIC'),
  privateKey: Env.get('BRAINTREE_KEY_PRIVATE')
};

Example Usage

const Gateway = use('BraintreeGateway')

Route.get('/braintree/token', function *(request, response){
    gateway.clientToken.generate({}, function (err, res){
        yield response.send(res.clientToken);
      });
})

Readme

Keywords

none

Package Sidebar

Install

npm i adonis-braintree

Weekly Downloads

1

Version

1.0.5

License

ISC

Last publish

Collaborators

  • compgeek28