I am trying to take an application fee on a stripe invoice that I send on behalf of a connected stripe standard account. However, I cannot figure out how to create the invoice either A) on the stripe standard account, then take a fee from it B) create the invoice on my platform account and use the application fee to get paid.
The closest documentation I can find is https://stripe.com/docs/connect/subscriptions#invoices. My code below returns this error "No such invoice: 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();
Expected results are sending an invoice branded that is branded to the connected standard account, and when it is paid, my platform account receives the fee.
connect
and creating Invoice on behalf of theConnected Account
, you will need to make use of theStripe Account
header (["stripe_account" => "{CONNECTED_STRIPE_ACCOUNT_ID}"]
) and usecus_xx
in the connected account. In this case, you will be able to set theapplication_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();
– Stein Christensen