【发布时间】:2019-07-08 01:35:12
【问题描述】:
我试图在我代表关联的 Stripe 标准账户发送的 Stripe 发票上收取申请费。但是,我无法弄清楚如何在条纹标准帐户上创建发票 A)然后从中收取费用 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();
预期的结果是向连接的标准账户发送带有品牌标识的发票,付款后,我的平台账户会收到费用。
【问题讨论】:
-
由于您使用
connect并代表Connected Account创建 Invoice,因此您需要使用Stripe Account标头 (["stripe_account" => "{CONNECTED_STRIPE_ACCOUNT_ID}"]) 并在关联账户。在这种情况下,您将能够设置application_fee -
@wsw 做到了!如果您添加为答案,我会接受。对于任何人来说,这里是使它工作的代码:
$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();
标签: stripe-payments