我正在使用Braintree nodejs Sdk作为我的项目之一, 我有使用customer.find()
函数的问题。 origina link is hereBraintree customer.find()不能使用Nodejs
当我以这种方式直接传递像'207'这样的用户标识时,它正在工作。
var braintree = require("braintree");
var gateway = require("./bt");
gateway.customer.find('207', function(err, customer) {
console.log("customer:",customer);
});
但是当我试图通过动态ID,它不工作;
btuserID = data.userId;
gateway.customer.find(btuserID, function(err, customer) {
console.log("customer:",customer);
});
我认为它的参数类型是字符串,所以我怎么可以传递参数没有双引号?
完全错误:
/home/api/node_modules/loopback-connector-mysql/node_modules/mysql/lib/protocol/Parser.js:82
throw err;
^
TypeError: undefined is not a function
at CustomerGateway.find (/home/api/node_modules/braintree/lib/braintree/customer_gateway.js:37:20)
你能尝试做'的console.log(btuserID)'的'gateway.customer.find'前行,只是为了确保'btuserID'是用户ID你期望它是? –
是的,我做到了这一点,它是207没有报价。 –
我在布伦特里工作。客户ID存储为字符串,因此您可以在将'btuserID'传递给'find'之前将其转换为字符串。根据你所得到的错误,然而,可能会有另一个问题。请联系[Braintree支持](https://support.braintreepayments.com)(可能会提供更多的服务器端代码)以获得进一步的帮助。 – cdeist