0
此命令meteor add patrickml:braintree
在Meteor應用程序目錄中運行。Meteor patrickml:braintree身份驗證錯誤
在client.main.js中:
波浪線在變量braintree
下,並且IDE顯示「未解析的變量或類型」。
Template.payment.onRendered(function() {
Meteor.call('getClientToken', function (error, clientToken) {
if (error) {
console.log(error); //<---- always prints out
} else {
//vvvvvvvvv
braintree.setup(clientToken, "dropin", {
container: "payment-form", // Injecting into <div id="payment-form"></div>
onPaymentMethodReceived: function (response) {
var nonce = response.nonce;
console.log(nonce);
}
});
}
});
});
在下面的服務器代碼中,clientId總是未定義的。
//server/main.js
'getClientToken': function (clientId) {
console.log(clientId); //<--------- undefined
let generateToken = Meteor.wrapAsync(gateway.clientToken.generate, gateway.clientToken);
let options = {};
if (clientId) {
options.clientId = clientId;
}
let response = generateToken(options);
return response.clientToken;
}
而且服務器控制檯打印出:
Exception while invoking method 'getClientToken' authenticationError: Authentication Error
任何想法是錯誤的,如何解決呢? thx
的布倫特裏例外['authenticationError'(https://developers.braintreepayments.com/reference/general/exceptions/#authentication-error)當你的API密鑰是不正確的上升。你有沒有檢查你的網關配置,以確保你使用正確的密鑰? – Shea
@Shea這是沙箱環境,鍵被從他們的網頁複製和粘貼,基本上是字母「x」的長串, –