如何收取代表关联帐户发送的发票的申请费

时间:2019-02-14 04:51:09

标签: stripe-payments

我正尝试对代表关联的条带标准帐户发送的条带发票收取申请费。但是,我无法弄清楚如何在条纹标准帐户上创建发票,然后从中收取费用B)在我的平台帐户上创建发票并使用申请费付款。

我能找到的最接近的文档是https://stripe.com/docs/connect/subscriptions#invoices。我的下面代码返回此错误“没有这样的发票:in_1E3c6TIMPzVAHwIq4ndgMsBV”。

$item=\Stripe\InvoiceItem::create([
    "customer" => "cus_ETsE8pqOpNnmdB",
    "amount" => 2500,
    "currency" => "usd",
    "description" => "One-time setup fee"
]);
$newInvoice=\Stripe\Invoice::create([
    "customer" => "cus_ETsE8pqOpNnmdB",
]);
$invoice = \Stripe\Invoice::retrieve(
    $newInvoice->id,
    ["stripe_account" => "acct_1AtpdCAO1KumKYA2"]
);
$invoice->application_fee = 100; // amount in cents
$invoice->save();

预期结果将发送带有商标的发票,该发票带有商标,该商标已关联到标准帐户,并且在付款后,我的平台帐户会收取费用。

1 个答案:

答案 0 :(得分:1)

感谢斯坦,

对于任何寻找它的人,下面的代码使其有效:

$item = \Stripe\InvoiceItem::create(["customer" => "cus_EWqTMbhPa537vV", "amount" => 2500], ["stripe_account" => "acct_1AtpdCAO1KumKYA2"]);
$newInvoice = \Stripe\Invoice::create(["customer" => "cus_EWqTMbhPa537vV"], ["stripe_account" => "acct_1AtpdCAO1KumKYA2"]);
$invoice = \Stripe\Invoice::retrieve($newInvoice->id, ["stripe_account" => "acct_1AtpdCAO1KumKYA2"]);
$invoice->application_fee = 100; // amount in cents 
$invoice->save();