How to set up and assign payments to multiple PayPal accounts in WooCommerce

woo multiple paypal

Perhaps one of the easiest things to do when creating an online store is to set up the payment gateways, and PayPal is no exception.

If you’re going to use the standard PayPal that comes with WooCommerce you just have to put in your PayPal email and it will work, and if you prefer/must use a PayPal Business account then with the free WooCommerce PayPal Express Checkout plugin that is suggested in the installation just activate it and the configuration practically does itself as well.

But what if you want to assign payments to different PayPal accounts? How do you do that?

WooCommerce does not contemplate this possibility by default, we have to add this functionality, which we can achieve in several ways, according to our needs.

How to assign different PayPal accounts by product code

If the situation is that, depending on the product, payment by PayPal must be made to different PayPal accounts then we have to generate a code that, depending on the product ID, uses one PayPal account or another.

This would be like the one in this example:

// 1. Different PayPal email depending on product ID add_filter( 'woocommerce_paypal_args' , 'wphelp_paypal_depending_on_product', 9999, 2 ); function wphelp_paypal_depending_on_product( $paypal_args, $order ) { foreach ( $order->get_items() as $item_id => $item ) { // Product ID here if ( 77777 == $item->get_product_id() ) { // Other PayPal email here $paypal_args['business'] = '[email protected]'; break; } } return $paypal_args; } // ------------------- // 2. Prevent IPN problems when changing email by product ID require_once WC()->plugin_path() . '/includes/gateways/paypal/includes/class-wc-gateway-paypal-ipn-handler.php'; class WC_Gateway_Paypal_IPN_Handler_Switch extends WC_Gateway_Paypal_IPN_Handler { protected function validate_receiver_email( $order, $receiver_email ) { if ( strcasecmp( trim( $receiver_email ), trim( $this->receiver_email ) ) !== 0 ) { // Other email used above here if ( $receiver_email != '[email protected]' ) { WC_Gateway_Paypal::log( "IPN Response is for another account: {$receiver_email}. Your email is {$this->receiver_email}" ); $order->update_status( 'on-hold', sprintf( __( 'Validation error: PayPal IPN response from a different email address (%s).', 'woocommerce' ), $receiver_email ) ); exit; } } } } new WC_Gateway_Paypal_IPN_Handler_Switch();
Code language: PHP (php)

Just change the product ID in the example (77777) and the additional PayPal email ([email protected]).

Disclaimer: The above sample code MAY cause unwanted effects, use it at your own risk. For example, it could interfere with PayPal’s refund handling (it’s best to remove the PayPal API keys from WooCommerce, as refunds will now have to be made manually from each PayPal account) or generate other errors

Note: The code above only contemplates changing the PayPal account for a product ID, so you may have to prevent more than 1 product from being added to the cart, additionally. You can easily do this in the inventory file of the product data.

How to spread revenue across multiple PayPal accounts

Another possible situation is that what you have to do is split the revenue between several PayPal accounts

In this case the PayPal Payouts for WooCommerce plugin is the ideal solution.

With this plugin you can:

  • Pay merchants or affiliates automatically with a single click, each to their PayPal account.
  • Pay everyone with a single click with batch actions.
  • Set the customized percentage for each PayPal account and automatically split payments after the purchase is completed.

Plus, the plugin integrates with Yith’s affiliate and multi-vendor plugin to activate automatic payments by PayPal to different accounts.

This way you can even set up a multi-seller store, or marketplace, in which you and the individual sellers each have a commission and the payments are set up to different PayPal accounts.

Assigning Multiple PayPal Accounts by Seller

The next step would be to directly create a multi-seller store, a marketplace, where each seller offers its products, and charges them based on a commission or with its own payment gateways and the one who receives the commission is you.

For this my favourite plugin is WooCommerce MultiVendor / MarketPlace.

Among its many settings and configurations to create your own marketplace, your own Amazon, you have the ability to assign different payment gateways to each seller, as well as commissions.

As you may have noticed there are several possibilities when assigning different PayPal accounts in WooCommerce, it just depends on how you want to use them.

Read this post in Spanish: Cómo configurar y asignar pagos a varias cuentas de PayPal en WooCommerce

Click to rate this post!
[Total: 2 Average: 5]

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top Skip to content