in eCommerce

Stripe Connect: How to Include Multiple Products in a Checkout Session

What is Stripe Connect?

Stripe Connect is a platform that allows businesses to accept payments from customers and pay out to third parties. It is designed to make it easy for businesses to connect with and use the Stripe payment platform, which enables businesses to process online payments and manage their financial operations.

With Stripe Connect, businesses can easily create and manage their own payment processing infrastructure, without having to worry about the technical details of building and maintaining their own payment gateway. Stripe Connect also provides tools for businesses to manage their financial operations, including features for invoicing, subscriptions, and recurring payments.

To use Stripe Connect, businesses must first create a Stripe account and connect it to their website or application. They can then use Stripe’s API to process payments and manage their financial operations. Stripe Connect is available in many countries around the world, and it supports a wide range of payment types, including credit and debit cards, bank transfers, and digital wallets.

Include Multiple Products in a Checkout Session

To include multiple products in a checkout session, you will need to use an e-commerce platform or payment gateway that supports the creation of a shopping cart or basket. This will allow customers to add multiple items to their order and pay for them all at once.

Here is an example of how this might work:

  1. The customer adds items to their shopping cart by clicking on an “Add to Cart” button on your website. This action should send an AJAX request to your server to add the item to the customer’s shopping cart.
  2. The customer can view the items in their shopping cart by clicking on a “View Cart” button on your website. This should take them to a page that displays all of the items in their cart, along with the total cost of the items.
  3. The customer can adjust the quantities of each item in their cart, or remove items from their cart, if desired.
  4. When the customer is ready to checkout, they can click on a “Proceed to Checkout” button on the cart page. This should take them to a payment page, where they can enter their billing and shipping information and choose a payment method.
  5. After the customer has completed the payment process, the e-commerce platform or payment gateway will process the order and complete the transaction.

You can use a variety of tools and technologies to implement this process, including server-side languages like PHP or Python, JavaScript libraries like jQuery, and e-commerce platforms like Shopify or WooCommerce. Check our guide to e-commerce platform market share.

One Stripe Connect Checkout Session with Multiple Products to Multiple Connected Account

If you want to send the money to multiple connected accounts, then you have to useĀ Separate Charges & Transfers. Based in the following example:

export const checkoutSessionSingular = functions.https.onCall(async (data, context) => {
  const session:any = await stripe.checkout.sessions.create({
    line_items: data.line_items,
    mode: "payment",
    success_url: "***",
    cancel_url: "***",
    payment_intent_data: {
      application_fee_amount: data.fee_amount,
      transfer_data: {
        destination: data.connectId,
      },
    },
  });
  return session;
});

You need to implement these steps:

  1. Create the Checkout Session and collect the payment, without any application_fee_amount or transfer_data
  2. Then manually create Transfers between your main Stripe account and the connected accounts, with this endpoint