The following is the braintree api to search for transaction. The result is received as stream. But Unable to read the received chunks in string or desired format.
以下是搜索事务的braintree api。结果以流的形式接收。但无法以字符串或所需格式读取收到的块。
var stream = gateway.transaction.search(function (search) {
result = search.paymentMethodToken().is("h337xg");
});
completeData = ""
stream.on("data", function(chunk){
// read the chunk
completeData += chunk;
});
stream.on("end", function(){
// print the output in console
console.log(completeData);
});
stream.resume();
The output that can be seen in the console is as : [object Object][object Object][object Object][object Object][object Object][object Object][object Object]
可以在控制台中看到的输出如下:[object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object]
1 个解决方案
#1
2
(I work at Braintree)
(我在布伦特里工作)
The data that's returned is a JSON object. In order to concatenate all the responses together, you'll need to have something like this:
返回的数据是JSON对象。为了将所有响应连接在一起,您需要具有以下内容:
completeData += JSON.stringify(chunk);
completeData + = JSON.stringify(chunk);
If you have any further questions on this, feel free to email our support team at support@braintreepayments.com
如果您对此有任何疑问,请随时通过support@braintreepayments.com向我们的支持团队发送电子邮件
#1
2
(I work at Braintree)
(我在布伦特里工作)
The data that's returned is a JSON object. In order to concatenate all the responses together, you'll need to have something like this:
返回的数据是JSON对象。为了将所有响应连接在一起,您需要具有以下内容:
completeData += JSON.stringify(chunk);
completeData + = JSON.stringify(chunk);
If you have any further questions on this, feel free to email our support team at support@braintreepayments.com
如果您对此有任何疑问,请随时通过support@braintreepayments.com向我们的支持团队发送电子邮件