2017-09-06 12 views
1

ストリーミング決済ゲートウェイから毎日、毎週、毎月、毎年のように私のアカウントの総収入を得る必要があります。 Node.js APIでこれを行う方法はありますか?私のアカウントの総収益をストライプ(Node.js)で取得する方法は?

私は、このいずれかを試してみました

var stripe = require("stripe")(
    "sk_test_R8lnqjR3wPDwbMhsc2pti0yN" 
); 

stripe.balance.retrieve(function(err, balance) { 
    console.log(balance); 
}); 

しかし、これが唯一の利用可能量を返します。毎日、毎週、毎月、毎年賢く必要です。

答えて

1

あなたはall transactionsをretrevingのストライプのAPIを使用することができ、その後、あなたはなど、月ごとの日、あなたの結果を計算することができます...

var stripe = require("stripe")(
    "sk_test_BQokikJOvBiI2HlWgH4olfQ2" 
); 

stripe.balance.listTransactions(
    { 
    starting_after: startAt, //specify your start date 
    ending_before: endAt, // specify your end date 
    }, function(err, transactions) { 

    // here sum the balance for the transactions 
}); 
関連する問題