【发布时间】:2014-04-04 22:42:43
【问题描述】:
我正在尝试在我的 Meteor 应用程序中使用 Braintree,并按照 this blog post on the subject 的说明制作了一个本地软件包 this Braintree packaging,并且安装顺利。
现在,我有这个代码:
// defined in server/fixtures.js
Gateway = braintree.connect({
environment: braintree.Environment.Sandbox,
merchantId: "secret",
publicKey: "secret",
privateKey: "secret"
});
它抛出了这个错误:
ReferenceError: braintree is not defined
(etc....)
然后我尝试按照the Braintree documentation 的建议加入这一行,但它只是抛出一个“require”未定义的错误。
var braintree = require("braintree");
Braintree 文档使用 Express 方法来实现一切,但这在这里帮助不大。
我之前引用的包将它定义为 server.js 并使用这一行:
Braintree = Npm.require("braintree");
所以我尝试将引用更改为 Braintree 而不是 braintree,但这未定义完全相同的方式。
我如何在 Braintree 使用它?
提前致谢!
【问题讨论】: