簡體   English   中英

Stripe - 如何在訂閱中添加關聯賬戶(申請費金額)?

[英]Stripe - how add connected account on the subscription (application fee amount)?

我嘗試將訂閱方法添加到我的項目中,客戶可以在其中訂閱其他用戶的產品。 但是我有問題,因為當我使用它時:

LineItems = new List<SessionLineItemOptions>
  {
    new SessionLineItemOptions
    {
      Price = "{{PRICE_ID}}",
      Quantity = 1,
    },
  },
  Mode = "subscription",
  SuccessUrl = "https://example.com/success",
  CancelUrl = "https://example.com/cancel",
  PaymentIntentData = new SessionPaymentIntentDataOptions
  {
    ApplicationFeeAmount = 123,
  },
};

var requestOptions = new RequestOptions
{
  StripeAccount = "{{CONNECTED_ACCOUNT_ID}}",
};
var service = new SessionService();
Session session = service.Create(options, requestOptions);

但是我有錯誤“您不能在subscription模式下傳遞payment_intent_data ”。我可以將關聯帳戶的申請費金額添加到訂閱中嗎?付款通常是唯一的選擇嗎?

附言。 我這樣創建我的產品:

var options = new ProductCreateOptions
                {
                    Name = "new product",
                    DefaultPriceData = new ProductDefaultPriceDataOptions
                    {
                        UnitAmount = price,
                        Currency = "pln"
                    },
                    Expand = new List<string> { "default_price" }
                };
                var requestOptions = new RequestOptions
                {
                    StripeAccount = stripeAccountId,
                };
                _productService.Create(options, requestOptions);

您將改用https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-application_fee_percent

var options = new Stripe.Checkout.SessionCreateOptions
{
...
   SubscriptionData = new Stripe.Checkout.SessionSubscriptionDataOptions
   {
      ApplicationFeePercent = 10
   },
};
...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM