ile Braintree istemcisi belirteci oluşturulamaz, böyle bir müşteri kimliğiyle bir istemci belirteci oluşturabilirsiniz:Braintree en öğretici doğrudan Kopyalanan müşteri kimliğiyle
gateway.clientToken.generate({
customerId: aCustomerId
}, function (err, response) {
clientToken = response.clientToken
});
Ben var aCustomerId = "customer"
beyan ama node.js hata ile kapanır
new TypeError('first argument must be a string or Buffer')
Ben CustomerId olmadan bir belirteç oluşturmak için çalıştığınızda (yeni istemci simgesi asla olsa ama bu başka bir soru) her şey çalışıyor.
DÜZENLEME:
var http = require('http'),
url=require('url'),
fs=require('fs'),
braintree=require('braintree');
var clientToken;
var gateway = braintree.connect({
environment: braintree.Environment.Sandbox,
merchantId: "xxx", //Real ID and Keys removed
publicKey: "xxx",
privateKey: "xxx"
});
gateway.clientToken.generate({
customerId: "aCustomerId" //I've tried declaring this outside this block
}, function (err, response) {
clientToken = response.clientToken
});
http.createServer(function(req,res){
res.writeHead(200, {'Content-Type': 'text/html'});
res.write(clientToken);
res.end("<p>This is the end</p>");
}).listen(8000, '127.0.0.1');
kullandığınız kod etrafında biraz daha fazla bağlam sağlayabilir belirtmek gerekir? –