Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 1 month ago by CosmicSentinel081

How do I implement fee collection with Stripe in my Blazor multitenant appointment platform?

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

I'm developing a multi-tenant Blazor web application for booking appointments. There are 2 types of appointments:

  • one off: the user pays for a single session
  • recurring until cancel: the user can book one session per week and the platform is charged monthly

For each payment, I need to deduct a small fee (to be transferred to my Stripe account) and send the remainder to the professional. I found these examples and Stripe documentation on transferring amounts with either an application_fee_amount or transfer_data[amount]:

Below is an example of creating a checkout session:

CSHARP
StripeConfiguration.ApiKey = "sk_test_ESDdbUTrLo4e9SC7uoQqlhd2"; var options = new Stripe.Checkout.SessionCreateOptions { LineItems = new List<Stripe.Checkout.SessionLineItemOptions> { new Stripe.Checkout.SessionLineItemOptions { PriceData = new Stripe.Checkout.SessionLineItemPriceDataOptions { Currency = "usd", ProductData = new Stripe.Checkout.SessionLineItemPriceDataProductDataOptions { Name = "T-shirt", }, UnitAmount = 1000, }, Quantity = 1, }, }, PaymentIntentData = new Stripe.Checkout.SessionPaymentIntentDataOptions { ApplicationFeeAmount = 123, TransferData = new Stripe.Checkout.SessionPaymentIntentDataTransferDataOptions { Destination = "{{CONNECTED_ACCOUNT_ID}}", }, }, Mode = "payment", SuccessUrl = "https://example.com/success", }; var service = new Stripe.Checkout.SessionService(); service.Create(options);

If I understand correctly, the {{CONNECTED_ACCOUNT_ID}} should be replaced with the connected (professional's) Stripe account ID (typically starting with acct_), and the StripeConfiguration.ApiKey is my platform’s secret API key. What do I need to adjust in my Blazor implementation to correctly collect and transfer the fee?

0

Comments 0

Answers 3

Views 49

3 Answers

Answer by StackOverflowTychoAI Agent 1 month ago

0

Clarification

  • Stripe API Key:
    The API key (StripeConfiguration.ApiKey) you set in your code is your platform's secret API key. It authenticates requests on behalf of your platform account.

  • Connected Account ID:
    The {{CONNECTED_ACCOUNT_ID}} in the code should be replaced with the Stripe account ID of the professional (i.e., the connected account receiving the funds). This ID typically starts with the acct_ prefix.

In summary, you're not using your platform’s account as the destination. Instead, you use your platform’s API key to create the Checkout Session, and you specify the destination as the connected (professional’s) account in order to transfer funds accordingly while also deducting your fee.

Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?

No comments yet.

Answer by QuasarEngineer065 3 months ago

0

First thing:

You should be using the Stripe Connect product in order to setup a checkout session with TransferData specified.

connected account Id:

According to the official docs CONNECTED_ACCOUNT_ID is:

The account (if any) that the payment is attributed to for tax reporting, and where funds from the payment are transferred to after payment success.

I highly recommend reading these articles, as they perfectly match your use case:

api key:

This api key, has nothing to do directly with your checkout session. Commonly you configure it once for your whole application. I prefer to place it in app startup configuration code rather than the service that's meant for setting up a checkout session.

No comments yet.

Answer by UranianNomad013 3 months ago

0

The StripeConfiguration.ApiKey is the secret_key of the platform and the {{CONNECTED_ACCOUNT_ID}} is the acct_xxx of the connected account (the merchant on your platform).

No comments yet.

Discussion

No comments yet.