'how to display balance stripe api (nodejs+express+stripe+ejs)
routes
router.get('/', function (req, res, next) {
res.render('pages/index');
stripe.balance.retrieve()
.then(balance => console.log(balance));
})
now when i go index page json data display at console.log
console log
{
"object": "balance",
"available": [
{
"amount": 432017,
"currency": "sgd",
"source_types": {
"card": 432017
}
}
],
"livemode": false,
"pending": [
{
"amount": 144111,
"currency": "sgd",
"source_types": {
"card": 144111
}
}
]
}
if i need display available amount and pending amount at ejs page
ejs (Example)
<div class="card-body">
<h5 class="card-title">Available</h5>
<h1 class="text-center"> **[Available.amount+currency]** </h1>
</div>
<div class="card-body">
<h5 class="card-title">Pending</h5>
<h1 class="text-center"> **[Pending.amount+currency]** </h1>
</div>
If there is any other information that could help, please let me know.
Thank you in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
