In order to make the partial payment possible, should custom module override PaymentMethod.php file in below path? How would be for and type in di.xml?


In di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="vendor\braintree\braintree_php\lib\Braintree\PaymentMethod" type="Myvendor\myModule\lib\CustomPaymentMethod" />


namespace Myvendor\myModule\lib;

class CustomPaymentMethod extends Base
    protected $_canCapture                  = true;
    protected $_canCapturePartial           = true;

    // static methods redirecting to gateway

    public static function create($attribs)
        return Configuration::gateway()->paymentMethod()->create($attribs);

    public static function find($token)
        return Configuration::gateway()->paymentMethod()->find($token);

    public static function update($token, $attribs)
        return Configuration::gateway()->paymentMethod()->update($token, $attribs);

    public static function delete($token)
        return Configuration::gateway()->paymentMethod()->delete($token);
class_alias('Braintree\PaymentMethod', 'Braintree_PaymentMethod');

1 Answer 1


As I understand, you want to use partial capturing for Braintree.

Braintree officially doesn't support partial capturing, this is restricted feature, but they have that functionality Transaction::submitForPartialSettlement().

But Magento Braintree implementation supports the partial capturing (it uses some strategies to resolve capture operations), so if you need this feature, you don't need to override any code in Braintree SDK.

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.