1.0.5 • Published 7 years ago

adonis-braintree v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

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);
      });
})
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago