I am trying to convert this Braintree nested callback into async/await:
var stream = gateway.transaction.search(function (search) {
search.customerId().is(braintreeCustomerId);
}, function (err, response) {
response.each(function (err, transaction) {
console.log(transaction);
});
});
I tried this approach but I am getting undefined
response output:
await gateway.transaction.search(async (search) => {
const response = await search.customerId().is(braintreeCustomerId);
console.log(response)
})
What am I doing wrong?