Introduction

In a modern e-commerce environment, especially in marketplaces, the ability to split payments between multiple vendors or recipients is crucial. WooCommerce doesn’t support split payments natively, but with custom logic and the right tools (like Stripe Connect, PayPal Adaptive, or custom gateway integration), you can build a robust split payment system.

In this post, we’ll explore:

  • What split payments are
  • Use cases (multi-vendor, affiliate, booking systems)
  • Architectural approaches
  • Implementation with Stripe Connect
  • Example code hooks for logic control

What Is a Split Payment System?

A split payment system allows an order total to be divided among:

  • Multiple vendors
  • Admin commission
  • Different payment gateways

For example:

Customer places an order for 2 products from different vendors.
Payment is processed once, but:

  • Vendor A gets 70%
  • Vendor B gets 20%
  • Admin receives 10% commission

Tools & Plugins You Can Use

Depending on your use case, you may want to combine code with third-party plugins:

Plugin-Based:

  • Dokan, WCFM, or WC Vendors (Marketplace frameworks)
  • Stripe Connect (Official WooCommerce extension for split payments)
  • PayPal Payouts / Adaptive Payments
  • WooCommerce Subscriptions + Action Scheduler (for delayed/manual payouts)

Split Payment Flow Architecture

1. Payment Handling

  • Process payment once at checkout.
  • Use Stripe Connect or PayPal Adaptive to distribute payment.

2. Order Association

  • Identify which products belong to which vendor.
  • Store vendor-user mapping or use marketplace plugin post meta.

3. Commission Calculation

  • Calculate % to split per vendor.
  • Deduct platform commission (admin fee).

4. Payouts

  • Immediate (via Stripe Connect)
  • Delayed/Manual (via scheduler or triggers)

Implementing Split Payments with Stripe Connect

You’ll need:

  • Stripe account with Connect enabled
  • WooCommerce Stripe Gateway Plugin
  • Connected vendor accounts (via OAuth)

1. Register Vendors to Stripe Connect

Vendors need to authorize your app:

phpCopyEdit// Vendor onboarding link
$stripe_url = "https://connect.stripe.com/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&scope=read_write";

After authorization, store their stripe_user_id in user meta.

2. Hook Into Checkout Process

Use the woocommerce_checkout_order_processed or woocommerce_payment_complete hook:

add_action('woocommerce_payment_complete', 'bookwp_handle_split_payment');

function bookwp_handle_split_payment($order_id) {
    $order = wc_get_order($order_id);
    
    foreach ($order->get_items() as $item) {
        $product = $item->get_product();
        $vendor_id = get_post_field('post_author', $product->get_id());
        $vendor_stripe_id = get_user_meta($vendor_id, 'stripe_user_id', true);
        
        $amount = calculate_vendor_amount($item);
        
        // Send payment via Stripe Connect Transfer
        if ($vendor_stripe_id) {
            bookwp_send_stripe_transfer($vendor_stripe_id, $amount);
        }
    }
}

3. Transfer Funds Using Stripe PHP SDK

function bookwp_send_stripe_transfer($account_id, $amount) {
    \Stripe\Stripe::setApiKey('your_stripe_secret_key');

    \Stripe\Transfer::create([
        "amount" => $amount * 100,
        "currency" => "usd",
        "destination" => $account_id,
        "transfer_group" => "ORDER_1234",
    ]);
}

Custom Commission Logic

You can define a global or per-vendor commission structure:

function calculate_vendor_amount($item) {
    $price = $item->get_total();
    $commission_rate = 0.90; // 10% admin cut
    return $price * $commission_rate;
}

Or make it dynamic per vendor using meta:

$rate = get_user_meta($vendor_id, 'commission_rate', true) ?: 0.9;

Alternative: Delayed Payouts

For manual or scheduled payouts:

  • Store balances in custom DB table
  • Use wp_schedule_event() or Action Scheduler
  • Allow admin to trigger payout via Stripe or PayPal

Security & Edge Case Considerations

  • Validate that vendors have completed onboarding.
  • Check available Stripe balance before transfers.
  • Add error logging for failed payouts.
  • Refunds: Decide whether to deduct from vendor balance or hold reserve.

Conclusion

Building a split payment system in WooCommerce is very achievable, especially with:

  • Stripe Connect for real-time payouts
  • Custom hooks and logic for commission control
  • WooCommerce’s powerful extensibility

This is a foundational feature for multi-vendor marketplaces, affiliate systems, and service marketplaces.