Skip to content

Latest commit

 

History

History
69 lines (54 loc) · 1.76 KB

README.md

File metadata and controls

69 lines (54 loc) · 1.76 KB

ember-braintree-components

This addon includes Braintree's Drop-In Payment UI and Auth Connect button as Ember components.

Installation

# From within your ember-cli project
ember install ember-braintree-components

Usage

Drop-In UI

// template.hbs
<form>
  {{!-- Must be inside of a <form> --}}
  {{braintree-dropin
    token=braintreeClientToken
    onSubmit=(action 'submit')
  }}
  <button type="submit">Submit</button>
</form>
// controller/component.js
actions: {
  submit(response) {
    // Do something with the nonce
    return this.get('ajax').post('[YOUR URL]', {
      data: {
        paymentNonce: response.nonce
      }
    });
  }
}

drop-in ui

  • token(required) - the token generated by your server
  • onReady - action fired when the UI is ready
  • onSubmit - action fired when the form is submitted (called with payment nonce)
  • onError - action fired when an error occurred
  • options - a hash containing additional options

See the documentation for more information on these options.

Braintree Auth Connect button

// template.hbs
{{braintree-connect-button
  connectUrl=connectUrl
  onError=(action 'onError')
}}

Connect with Braintree

Options

  • connectUrl(required) - the url generated by your server
  • onError - action fired when an error occurred
  • options - a hash containing additional options

See the documentation for more information on these options.