{"action":"created","issue":{"url":"https://api.github.com/repos/patrickml/braintree/issues/20","labels_url":"https://api.github.com/repos/patrickml/braintree/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/patrickml/braintree/issues/20/comments","events_url":"https://api.github.com/repos/patrickml/braintree/issues/20/events","html_url":"https://github.com/patrickml/braintree/issues/20","id":106268906,"number":20,"title":"Error: braintree is not defined","user":{"login":"turbogeek","id":133117,"avatar_url":"https://avatars.githubusercontent.com/u/133117?v=3","gravatar_id":"","url":"https://api.github.com/users/turbogeek","html_url":"https://github.com/turbogeek","followers_url":"https://api.github.com/users/turbogeek/followers","following_url":"https://api.github.com/users/turbogeek/following{/other_user}","gists_url":"https://api.github.com/users/turbogeek/gists{/gist_id}","starred_url":"https://api.github.com/users/turbogeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turbogeek/subscriptions","organizations_url":"https://api.github.com/users/turbogeek/orgs","repos_url":"https://api.github.com/users/turbogeek/repos","events_url":"https://api.github.com/users/turbogeek/events{/privacy}","received_events_url":"https://api.github.com/users/turbogeek/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-14T04:21:02Z","updated_at":"2015-09-15T19:49:33Z","closed_at":"2015-09-15T19:49:33Z","body":"Hi, maybe this is just a documentation issue, but I am getting a Error: braintree is not defined. Do I need to install Braintree? It is not clear if that is my issue or perhaps there is something else going on. Here is the code (keys removed) and the error:\r\nvar customer;\r\ntry{\r\n    var bt = BrainTreeConnect({\r\n        \r\n        environment:  braintree.Environment.Sandbox,\r\n        merchantId:   '...',\r\n        publicKey:    '...',\r\n        privateKey:   '...'\r\n    });\r\n    customer = bt.customer.create(config);\r\n    console.log(\"customer:\",customer);\r\n} catch(error){\r\n    throw new Meteor.Error(1001, error.message);\r\n}\r\n\r\n\r\nW20150913-23:13:01.481(-5)? (STDERR) Error: braintree is not defined [1001]\r\nW20150913-23:13:01.481(-5)? (STDERR)     at app/server/braintree.js:21:11\r\nW20150913-23:13:01.481(-5)? (STDERR)     at app/server/braintree.js:24:3\r\nW20150913-23:13:01.481(-5)? (STDERR)     at /Users/turbogeek/work/q_again/quantum/.meteor/local/build/programs/server/boot.js:222:10\r\nW20150913-23:13:01.481(-5)? (STDERR)     at Array.forEach (native)\r\nW20150913-23:13:01.481(-5)? (STDERR)     at Function._.each._.forEach (/Users/turbogeek/.meteor/packages/meteor-tool/.1.1.3.96aw17++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)\r\nW20150913-23:13:01.481(-5)? (STDERR)     at /Users/turbogeek/work/q_again/quantum/.meteor/local/build/programs/server/boot.js:117:5"},"comment":{"url":"https://api.github.com/repos/patrickml/braintree/issues/comments/140517249","html_url":"https://github.com/patrickml/braintree/issues/20#issuecomment-140517249","issue_url":"https://api.github.com/repos/patrickml/braintree/issues/20","id":140517249,"user":{"login":"turbogeek","id":133117,"avatar_url":"https://avatars.githubusercontent.com/u/133117?v=3","gravatar_id":"","url":"https://api.github.com/users/turbogeek","html_url":"https://github.com/turbogeek","followers_url":"https://api.github.com/users/turbogeek/followers","following_url":"https://api.github.com/users/turbogeek/following{/other_user}","gists_url":"https://api.github.com/users/turbogeek/gists{/gist_id}","starred_url":"https://api.github.com/users/turbogeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turbogeek/subscriptions","organizations_url":"https://api.github.com/users/turbogeek/orgs","repos_url":"https://api.github.com/users/turbogeek/repos","events_url":"https://api.github.com/users/turbogeek/events{/privacy}","received_events_url":"https://api.github.com/users/turbogeek/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T19:49:33Z","updated_at":"2015-09-15T19:49:33Z","body":"Ok, Braintree/braintree was the issue. Here is a version of the example with a sample config for creating the customer (got it from the Braintree site). From long experience I have learned that the only good sample code is executable sample code :o)\r\n\r\n```\r\nvar customer;\r\ntry{\r\n    var bt = BrainTreeConnect({\r\n        //If you set an ENV variable for PRODUCTION you can dynamically change out sandbox and production\r\n        environment:  Braintree.Environment.Sandbox,\r\n        merchantId:   '...',\r\n        publicKey:    '...',\r\n        privateKey:   '...'\r\n    });\r\n    var config ={\r\n        firstName: \"Jen\",\r\n        lastName: \"Smith\",\r\n        company: \"Braintree\",\r\n        email: \"jen@example.com\",\r\n        phone: \"312.555.1234\",\r\n        fax: \"614.555.5678\",\r\n        website: \"www.example.com\"\r\n    };\r\n\r\n    customer = bt.customer.create(config, function (err, result) {\r\n        console.log( \"result.success:\", result.success);\r\n        // true\r\n        console.log( \"result.customer.id:\",result.customer.id);\r\n        // e.g. 494019\r\n    });\r\n    console.log(\"customer:\",customer);\r\n} catch(error){\r\n    throw new Meteor.Error(1001, error.message);\r\n}\r\n```"}}