cordova-plugin-braintree icon indicating copy to clipboard operation
cordova-plugin-braintree copied to clipboard

Reference error: BraintreePlugin not defined

Open kolawoletech opened this issue 8 years ago • 10 comments

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?

kolawoletech avatar Mar 01 '17 21:03 kolawoletech

On what platform? The plugin (currently) doesn't work in browser, only on ios and android platforms. Can you copy the exact error?

Taracque avatar Mar 02 '17 08:03 Taracque

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. (http://localhost:8100/build/main.js:95230:37) at HTMLButtonElement. (http://localhost:8100/build/main.js:37046:36) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723) at Object.onInvokeTask (http://localhost:8100/build/main.js:35117:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9659) at e.runTask (http://localhost:8100/build/polyfills.js:3:7083) at HTMLButtonElement.invoke (http://localhost:8100/build/polyfills.js:3:10836) Ionic Framework: 2.0.0-rc.5 Ionic Native: 2.2.11 Ionic App Scripts: 1.0.0 Angular Core: 2.2.1 Angular Compiler CLI: 2.2.1 Node: 6.9.4 OS Platform: Windows 10 Navigator Platform: Win32 User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

kolawoletech avatar Mar 02 '17 09:03 kolawoletech

Android or ios?

Taracque avatar Mar 02 '17 11:03 Taracque

I plan on deploying on both, But for now it is an android issue so Android, Yes

kolawoletech avatar Mar 02 '17 11:03 kolawoletech

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

Taracque avatar Mar 02 '17 14:03 Taracque

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?

screenshot 2017-03-03 00 08 58 screenshot 2017-03-03 00 03 48

kolawoletech avatar Mar 02 '17 22:03 kolawoletech

i have tried many solutions, token initiliase and is set but dropinUI never pops

kolawoletech avatar Apr 14 '17 19:04 kolawoletech

Can you upload an example project?

Taracque avatar Apr 18 '17 09:04 Taracque

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

jayordway avatar May 02 '17 11:05 jayordway

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

});`

durgeshsatyam avatar Dec 28 '17 06:12 durgeshsatyam