0.1.0 • Published 9 years ago
ember-braintree-components v0.1.0
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-componentsUsage
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
}
});
}
}
token(required) - the token generated by your serveronReady- action fired when the UI is readyonSubmit- action fired when the form is submitted (called with payment nonce)onError- action fired when an error occurredoptions- 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')
}}Options
connectUrl(required) - the url generated by your serveronError- action fired when an error occurredoptions- a hash containing additional options
See the documentation for more information on these options.
0.1.0
9 years ago