cordova-plugin-braintree
cordova-plugin-braintree copied to clipboard
Reference error: BraintreePlugin not defined
In my ionic2 provider file I declared BraintreePlugin but I get a reference error https://github.com/kolawoletech/ionic2-marketcloud/blob/ionic2-marketcloud/src/providers/cart-service.ts
Is it a typings issue? What is going on here?
On what platform? The plugin (currently) doesn't work in browser, only on ios and android platforms. Can you copy the exact error?
Runtime Error
Error in ./OrderPage class OrderPage - caused by: BraintreePlugin is not defined
Stack
ReferenceError: BraintreePlugin is not defined
at CartService.createOrder (http://localhost:8100/build/main.js:57261:21)
at OrderPage.processOrder (http://localhost:8100/build/main.js:57050:40)
at CompiledTemplate.proxyViewClass.View_OrderPage0.handleEvent_74 (/AppModule/OrderPage/component.ngfactory.js:1065:34)
at CompiledTemplate.proxyViewClass.
Android or ios?
I plan on deploying on both, But for now it is an android issue so Android, Yes
I've no idea, you have the declare var BraintreePlugin: any;
declaration, that should work.
Please check that you see braintree-plugin.js in Chrome remote debugger (Should be under Sources/plugins/cordova-plugin-braintree)
I suggest you to update Ionic framework to 2.1.0. For me with the followin ionic components it works:
Ionic Framework Version: 2.1.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.3
With the braintree plugin was in the right place and everything seemed to work in the background up to the DropIn UI which never pops, Any ideas?
i have tried many solutions, token initiliase and is set but dropinUI never pops
Can you upload an example project?
I am getting this when running the ionic 2 up in the browser too:
Error: Uncaught (in promise): ReferenceError: BraintreePlugin is not defined ReferenceError: BraintreePlugin is not defined
Is it typings? How are they added?
I have declare var BraintreePlugin: any; near the top of my component and then try to initialize with braintree in the constructor
I was also getting the same error for my cordova Android App. but this issue resolved for me when I tried to initilize my BrainTree Plugin code inside the `var $$ = Dom7; $$(document).on('deviceready', function() {
// your brainTreePlugin code
});`