0

I am working on building what is essentially a custom pre-order module. I am using Braintree as the payment gateway, and requiring for pre-orders that a customer uses a vaulted credit card for payment.

The situation is fairly typical, which is that the original auth may fall off before the order is actually ready to ship (before the fulfillment house has inventory). Once the fulfillment house notifies Magento that it has inventory, before we send the order to the fulfillment warehouse to be shipped we need to re-auth the credit used for the order to ensure that the funds are still available and to ensure that once the order is shipped we'll be able to collect / capture payment.

Looking at Magento 2's Payment and Order classes, it SEEMS like perhaps this functionality should be easy ( 1. cancel / void previous auth 2. create a new auth transaction ), but I can't seem to find where the appropriate place for this functionality might be.

Thank you!

1 Answer 1

1

You can use Magento\Braintree\Model\AdapterBraintreeAdapter class for achieve you goal, just you need to change attribute value according your requirement.

For authorize action you have to set:

$attributes['options']['submitForSettlement'] = false;

And call sale function, this function is common for both action i.e authorize and authorize&capture

Create above array with all required parameters and values.

1
  • Thanks for the reply Yogesh! I've determined that I CAN authorize a new transaction, and the method you described above seems good (although in addition I believe I'd need to unset($attributes['paymentMethodNonce']); and $attributes['paymentMethodToken'] = '<token here>'; - my main concern though is that I want to do things the "Magento way" as much as possible, so if there is a better and less "deep in the code" way of handling this I'd like to take that approach! Jun 12, 2017 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.