[英]How to retain taxes collected in Platform Account - Stripe Connect
我正在為我的平台使用 Stripe Connect。 我的平台負責確保向相關稅務機關收取、收取和支付適當的稅款。 我的問題是 Stripe 正確計算了稅款,正確地向客戶收取了稅款……但它沒有將收取的稅款與申請費一起轉移到平台賬戶,而是將收取的稅款轉移到關聯賬戶。
這是我設置結帳的代碼 Session
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 合作,這是他們寫的:
我理解您的觀點,即稅額應留給平台,而 rest 將轉移到關聯賬戶,但從本質上講,這不是 Billing and Connect 產品的運作方式。
創建訂閱時,訂閱 object 將生成發票,發票將生成 payment_intents:
認購發票 - Payment_intent
發票-Payment_intent
payment_intent 包含一組屬性,包括金額、貨幣、客戶(如果有的話)等。但是,它沒有產品、折扣或稅收的概念,因為這些是訂閱和發票對象的屬性。
Connect 費用(即直接費用、目的地費用和單獨費用和轉賬費用)在 payment_intent 級別處理,而不是訂閱/發票級別。 他們也沒有產品、折扣和稅收的概念。 當您從 Checkout 設置連接流程時 session
- 在您的情況下,使用 subscription_data.transfer_data 屬性,amount_percent 不能與小計的相關,因為該小計金額在 payment_intent 級別不存在。
這是他們建議的解決方案。 我能夠毫不費力地實現它,所以它有效。
- 創建一個沒有任何 Connect 屬性的 Checkout session。 可以為結帳會話設置一個 transfer_group 參數,但它不適用於訂閱。 盡管如此,省略它並不妨礙您稍后處理 SCT。
- 從您的發票成功付款中保存費用 ID ch_xxx。 您可以從 charge.succeeded 事件或 payment_intent.succeeded 事件中接收此信息。 您可能還想監聽 invoice.payment_succeeded 或 invoice.paid 事件以獲取小計金額。
-創建一個轉賬,以關聯賬戶的acct_id為目的地,發票的小計為金額,費用的ch_id為source_transaction: https://stripe.com/docs/connect/charges-transfers#transfer-availability source_transaction參數很關鍵在這里 - 它會將轉賬鏈接到費用,這將確保資金被轉賬,即使您的余額尚不可用,並且會自動創建丟失的 transfer_group。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.