{"id":18582199,"date":"2025-08-01T19:11:05","date_gmt":"2025-08-01T19:11:05","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/split-payment-21\/"},"modified":"2025-08-01T19:11:05","modified_gmt":"2025-08-01T19:11:05","slug":"split-payment-21","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/split-payment-21\/","title":{"rendered":"Split Payment"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi there!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;m working on a WooCommerce + Dokan multi-vendor setup using BTCPay for WooCommerce v2 (latest version \u2013 2.7.2). I\u2019m trying to implement <strong>split payments<\/strong> using the <code>paymentMethod.destination<\/code> feature available on BTCPay Server invoices.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The idea is to split the payment between the marketplace and the vendor <strong>at the invoice level<\/strong>, without needing custodial wallets or post-processing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I added a filter in my <code>functions.php<\/code> to modify the invoice data like this:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">phpCopiar<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Editar<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">add_filter(&#8216;btcpaywc_v2_invoice_data&#8217;, function ($data, $order) {<br \/>$data[&#8216;checkout&#8217;][&#8216;paymentMethods&#8217;][] = [<br \/>&#8216;value&#8217; =&gt; 95,<br \/>&#8216;destination&#8217; =&gt; &#8216;[MARKETPLACE_ADDRESS]&#8217;,<br \/>&#8216;paymentMethod&#8217; =&gt; &#8216;BTC&#8217;,<br \/>];<br \/>$data[&#8216;checkout&#8217;][&#8216;paymentMethods&#8217;][] = [<br \/>&#8216;value&#8217; =&gt; 5,<br \/>&#8216;destination&#8217; =&gt; &#8216;[VENDOR_ADDRESS]&#8217;,<br \/>&#8216;paymentMethod&#8217; =&gt; &#8216;BTC&#8217;,<br \/>];<br \/>return $data;<br \/>}, 10, 2);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, BTCPay seems to ignore the custom destinations and routes the full amount to the store&#8217;s main wallet instead.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Questions:<\/p>\n\n\n\n<ul>\n<li>Does the plugin support this use case?<\/li>\n\n\n\n<li>Is <code>checkout.paymentMethods<\/code> the right key to modify?<\/li>\n\n\n\n<li>Are there any specific conditions (store permissions, BTCPay version, etc) needed for this to work?<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks in advance for any insight!<\/p>\n","protected":false},"template":"","class_list":["post-18582199","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18582199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18582199\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18582199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}