我正在使用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