$po = 'po_sadfahk.....'; // payout id (i do a loop of payouts)
\Stripe\Stripe::setApiKey($stripeSecretKey);
$balanceTransactions = \Stripe\BalanceTransaction::all([
'payout' => "$po",
'type' => 'charge',
'limit' => 100, // default is 10, but a payout can have more pi's
'expand' => ['data.source'],
]);
foreach ($balanceTransactions->data as $txn) {
// my invoice id is added in description when creating the payment intent
echo "Invoice: {$txn->description}\n";
echo "Created: {$txn->created}\n";
echo "Available: {$txn->available_on}\n";
// in source we find the pi_id, amount and currency for each payment intent
$charge = $txn->source;
echo "pi: {$charge->payment_intent}\n";
$amount = $charge->amount/100;
echo "$amount {$charge->currency}\n";
}
3条答案
按热度按时间6yjfywim1#
我有同样的挑战,不得不通过4支持者,告诉我的需求一遍又一遍,在我终于得到正确的提示,可以完成我的检查和cron作业.我在这里提供我的解决方案,以保存其他人相同的经验:
输出(裁剪为相关数据):
bjp0bcyl2#
我不确定您是否拥有标准账户的访问权限,但如果您拥有,您将能够列出与该支出相关的所有余额交易,其中将引用
source
字段中的付款意向,以获取任何付款意向。bxfogqkk3#
感谢金正日的回答。我也在Stripe找了很多支持者,但都无济于事。他的帖子让我明白了。
下面的代码只是Kim上面代码的Python 3.10翻译