williankeller / magento2-split-order

[DEPRECATED] This extension allows your Magento store to split the order into an order for each item in the cart.

Home Page:https://magestat.com/extensions/magento2-split-order

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work with Braintree, Paypal via Braintree, Paypal Express Checkout

rg-srini opened this issue · comments

Thanks for the module first.

We tested with Magento EE 2.1.4 and 2.2.5 CE with the below payment methods. Not working as expected below.

  • Braintree,
  • Braintree Vault
  • Paypal via Braintree (Sandbox)
  • Paypal Express Checkout

Expected output

  • One order should have been split into 3 orders based on the cart item product attribute value (configured)
  • If a user has authorized a payment of $100 for the entire order, based on the cart items, 3 orders are expected to generated as below.
    • Order 1 - $30
    • Order 2 - $30
    • Order 3 - $40
  • The parent payment transaction should be attached to all other 2 orders.
  • Admin user should be able to create separate invoice the for each order and capture.
  • Admin user should be able to create creditmemo from each of the above generated invoices

.

Thanks,
Srini

Hi @rg-srini, thanks for your comment, we already have this issue tracked. In fact this module don't work properly with external payment methods. We are working pro provide a new version with these fixes.

Thanks a lot. We are also trying at our end.

Ref:
https://webkul.com/blog/create-payment-transaction-in-magento2/

Hi @rg-srini and @williankeller, I forked this and spent a few days trying to get this to work with Braintree. You'll likely run into the same issues I did which is that, for a vaulted Braintree card, it's fairly easy to get a new payment nonce for each split but for non-vaulted card, you've got to temporarily vault the card to get a re-usable token, which may be against customer's wishes. I didn't even get into PayPal once I hit this obstacle. Ideally, you'd have one auth and captures per split but it looks like Braintree uses the order number as part of allowing a capture, so each capture would have to be against a parent order. Gets pretty complicated. One of the devs on the M2 Slack channel said they did this in the past with 'meta' orders, so one parent order holds all of the payment info and there are meta 'child' orders for warehouse. Hope that helps a bit. Good luck!

Thanks for the feedback @wsheldon, I'll look into the meta orders.

The reason this doesn't work is the same reason why all native Magento online payment modules do not work with the multi-address checkout flow.
Credit card authorizations can only be captured once. In the auth-only order flow, the authorization is redeemed when the order is invoiced.
This creates issues when generating multiple invoices for a single order and/or payment authorization.

The Auth.net CIM module that @pmclain made work with multi-address shipping by creating a separate authorization for each order created when the user places an order. Here's a link to the full group of commits https://github.com/pmclain/module-authorizenetcim/pull/2/commits.
Here was the flow I used at a very high-level:

  1. Card information is tokenized via accept.js client side
  2. Card token is passed with the order placement request for redemption as a new authorization, but the token is a one-time use.
  3. The token is converted to a stored payment source in CIM. The CIM API returns the new payment source which is available for future transactions.
  4. The re-usable payment source is stored in a singleton object.
  5. As each order is created the module pulls the payment source from the singleton.

This approach works but is not ideal because you are forced to store the card in CIM even if the user opted to not store the card for future use via the Magento_Vault. This probably creates compliance issues with privacy laws such as GDPR.

Sorry, I don't have a good answer. This has been something that has bothered me for the last months.