如何保留在平台账户中收取的税款 - Stripe Connect
How to retain taxes collected in Platform Account - Stripe Connect
我正在为我的平台使用 Stripe Connect。我的平台负责确保向相关税务机关收取、收取和支付适当的税款。我的问题是 Stripe 正确计算了税款,正确地向客户收取了税款……但它没有将收取的税款与申请费一起转移到平台账户,而是将收取的税款转移到关联账户。
这是我设置结帐会话的代码
require APPPATH .'third_party/stripe-php/init.php'; // Include the Stripe PHP bindings library
\Stripe\Stripe::setApiKey($this->CI->config->item('stripe_api_key')); // Set API key
$reg_id = $this->input->post('reg_id');
$stripe_price_id = $this->input->post('stripe_price_id'); //this gets connected account number 'inst' is creator id value hidden in button
$stripeAccount = $this->Profiles_model->fetch_stripe_account_by_id($reg_id);
$email = $this->session->userdata('email');
$stripeCustomerID = $this->Profiles_model->fetch_stripe_customerID($email);
$session = \Stripe\Checkout\Session::create([
'customer' => $stripeCustomerID,
'customer_update' => [
'address' => 'auto',
],
'payment_method_types' => ['card'],
'mode' => 'subscription',
'metadata' => ['creator_id' => $reg_id],
"line_items" => [
['price' => $stripe_price_id,
'quantity' => 1,
],
],
'automatic_tax' => [
'enabled' => true,
],
'subscription_data' => [
// 'application_fee_percent' => 25,
'transfer_data' => [
'destination' => $stripeAccount,
'amount_percent' => 75,
],
],
'success_url' => 'https://example.com/purchasesuccess',
'cancel_url' => 'https://example.com/privatemember',
]);
Stripe 建议我只增加我的申请费以支付税额,但是当收取的税额因客户所在地而异时我该怎么做?我想也许我可以使用类似的东西来绕过它:
'application_fee_amount' => ($fee+'line_items.data.amount_total'-'line_items.data.amount_subtotal'),
或
'application_fee_amount' => ($fee+'amount_total'-'amount_subtotal'),
或使用
'amount_percent' => 75,
文档说“amount_percent”是基于小计,但它转移了总额的 75%(即基本价格 + 税)。
想法?
所以我正在与 Stripe 合作,这是他们写的:
I understand your point that tax amount should be left to the
platform, while the rest is transferred to the connected account,
however at its core, that is not how the Billing and Connect product
operate.
When you create a subscription, the subscription object will generate
invoices, which will generate payment_intents :
Subscription
Invoice -
Payment_intent
Invoice -Payment_intent
payment_intent 包含一组属性,其中包括
金额、货币、客户(如果有)等。但是,它
没有产品、折扣或税收的概念,因为这些都是
订阅和发票对象的属性。
连接费用(即直接费用、目的地费用和单独费用以及
传输)在 payment_intent 级别处理,而不是订阅 /
发票级别。他们也没有产品、折扣的概念
和税收。当您从结帐会话设置连接流程时
- 在您的情况下,使用 subscription_data.transfer_data 属性,amount_percent 无法与小计的属性相关联,因为这
payment_intent 级别不存在小计金额。
这是他们建议的解决方案。我能够毫不费力地实现它,所以它有效。
-Create a Checkout session without any Connect attribute. There is a transfer_group parameter that can be set for Checkout sessions, but it
isn't available for subscriptions. Nevertheless, omitting it doesn't
prevent you from handling SCT later on.
-Save the charge ID ch_xxx from your invoice's succeeded payment. You can receive this information from the charge.succeeded event or
payment_intent.succeeded event. You may also want to listen for
invoice.payment_succeeded or invoice.paid events to get the subtotal
amount.
-Create a transfer, with the connected account's acct_id as destination, the invoice's subtotal as amount, and the charge's ch_id
as source_transaction :
https://stripe.com/docs/connect/charges-transfers#transfer-availability
The source_transaction parameter is crucial here - it will link the
transfer to the charge, which will ensure funds are transferred even
if they aren't available to your balance yet, and will create the
missing transfer_group automatically.
我正在为我的平台使用 Stripe Connect。我的平台负责确保向相关税务机关收取、收取和支付适当的税款。我的问题是 Stripe 正确计算了税款,正确地向客户收取了税款……但它没有将收取的税款与申请费一起转移到平台账户,而是将收取的税款转移到关联账户。
这是我设置结帐会话的代码
require APPPATH .'third_party/stripe-php/init.php'; // Include the Stripe PHP bindings library
\Stripe\Stripe::setApiKey($this->CI->config->item('stripe_api_key')); // Set API key
$reg_id = $this->input->post('reg_id');
$stripe_price_id = $this->input->post('stripe_price_id'); //this gets connected account number 'inst' is creator id value hidden in button
$stripeAccount = $this->Profiles_model->fetch_stripe_account_by_id($reg_id);
$email = $this->session->userdata('email');
$stripeCustomerID = $this->Profiles_model->fetch_stripe_customerID($email);
$session = \Stripe\Checkout\Session::create([
'customer' => $stripeCustomerID,
'customer_update' => [
'address' => 'auto',
],
'payment_method_types' => ['card'],
'mode' => 'subscription',
'metadata' => ['creator_id' => $reg_id],
"line_items" => [
['price' => $stripe_price_id,
'quantity' => 1,
],
],
'automatic_tax' => [
'enabled' => true,
],
'subscription_data' => [
// 'application_fee_percent' => 25,
'transfer_data' => [
'destination' => $stripeAccount,
'amount_percent' => 75,
],
],
'success_url' => 'https://example.com/purchasesuccess',
'cancel_url' => 'https://example.com/privatemember',
]);
Stripe 建议我只增加我的申请费以支付税额,但是当收取的税额因客户所在地而异时我该怎么做?我想也许我可以使用类似的东西来绕过它:
'application_fee_amount' => ($fee+'line_items.data.amount_total'-'line_items.data.amount_subtotal'),
或
'application_fee_amount' => ($fee+'amount_total'-'amount_subtotal'),
或使用
'amount_percent' => 75,
文档说“amount_percent”是基于小计,但它转移了总额的 75%(即基本价格 + 税)。
想法?
所以我正在与 Stripe 合作,这是他们写的:
I understand your point that tax amount should be left to the platform, while the rest is transferred to the connected account, however at its core, that is not how the Billing and Connect product operate.
When you create a subscription, the subscription object will generate invoices, which will generate payment_intents :
Subscription Invoice - Payment_intent
Invoice -Payment_intent
payment_intent 包含一组属性,其中包括 金额、货币、客户(如果有)等。但是,它 没有产品、折扣或税收的概念,因为这些都是 订阅和发票对象的属性。
连接费用(即直接费用、目的地费用和单独费用以及 传输)在 payment_intent 级别处理,而不是订阅 / 发票级别。他们也没有产品、折扣的概念 和税收。当您从结帐会话设置连接流程时
- 在您的情况下,使用 subscription_data.transfer_data 属性,amount_percent 无法与小计的属性相关联,因为这 payment_intent 级别不存在小计金额。
这是他们建议的解决方案。我能够毫不费力地实现它,所以它有效。
-Create a Checkout session without any Connect attribute. There is a transfer_group parameter that can be set for Checkout sessions, but it isn't available for subscriptions. Nevertheless, omitting it doesn't prevent you from handling SCT later on.
-Save the charge ID ch_xxx from your invoice's succeeded payment. You can receive this information from the charge.succeeded event or payment_intent.succeeded event. You may also want to listen for invoice.payment_succeeded or invoice.paid events to get the subtotal amount.
-Create a transfer, with the connected account's acct_id as destination, the invoice's subtotal as amount, and the charge's ch_id as source_transaction : https://stripe.com/docs/connect/charges-transfers#transfer-availability The source_transaction parameter is crucial here - it will link the transfer to the charge, which will ensure funds are transferred even if they aren't available to your balance yet, and will create the missing transfer_group automatically.