我是 STRIPE 的新手,我一直在阅读 STRIPE 的文档,我的任务是创建一个连接帐户的付款列表(类型是标准的)。另外,我必须在那些 PAYOUT 下显示其中包含的所有付款的详细信息。
但是,我看不出与 PAYMENT INTENTS/CHARGES 的 PAYOUTS 有任何关系,是否有可能知道 PAYOUTS 中包含的所有付款?我们正在为我们的用户创建标准连接帐户。
答案 0 :(得分:1)
我遇到了同样的挑战,不得不通过 4 个支持者,一遍又一遍地告诉我的需求,然后我终于得到了正确的提示,可以完成我的检查和 cron 工作。我在这里提供我的解决方案,以挽救其他人的相同体验:
$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";
}
输出(裁剪到相关数据):
{
"object": "list",
"data": [
{
"id": "txn_1ISOaSGqFEoKRtad...",
"object": "balance_transaction",
"amount": 25000,
"available_on": 1615680000,
"created": 1615131127,
"currency": "dkk",
"description": "Invoice 44",
...
"fee": 530,
"fee_details": [
{
"amount": 530,
"application": null,
"currency": "dkk",
"description": "Stripe processing fees",
"type": "stripe_fee"
}
],
...
"source": {
"id": "ch_1ISOaRGqFEoKR...",
"object": "charge",
"amount": 25000,
...
"paid": true,
"payment_intent": "pi_1ISOa3GqFE...", // here we go!
"payment_method": "pm_1ISOaRGqFE...",
"payment_method_details": {
"card": {
"brand": "visa",
...
},
"type": "card"
},
...
},
"status": "available",
"type": "charge"
}
],
"has_more": false,
"url": "/v1/balance_transactions"
}
答案 1 :(得分:0)
我不确定您是否会拥有标准帐户的访问权限,但如果您拥有该访问权限,您将能够list all of the Balance Transactions associated with that Payout,对于任何付款意图都会有一个 reference to the Payment Intent in the source
field .