Where can the logic|code that makes the API call to Braintree be found?

I have found the javascript that triggers when the Continue with Paypal Button is clicked .

Magento/Braintree/view/frontend/web/js/view/payment/method-readerer/paypal.js::payWithPayPal method.

Going with the debugger only takes me to minified non-redeable js. Beautifying the js is not of much help either.

I imagine that at a certain point an api call to braintree|paypal is made with information about the order (e.g grand total).

Where is the logic of this call found? Should I keep looking through js files or should I start looking through php files?

Setting a breakpoint on index.php when the button is clicked does not help as the execution does not arrive at index.php ( The debugger works )


It depends on what kind of logic you are looking for. If you need frontend logic, like payment nonce retrieving, card validation, 3d secure, etc you need to dive into:

  • Magento_Braintree/js/view/payment/method-renderer/hosted-fields.js for Braintree
  • Magento_Braintree/js/view/payment/method-renderer/paypal.js for Braintree PayPal

If you are interested in server-side processing at first look into Magento\Braintree\etc\di.xml - it contains all DI configurations for Braintree integration. As Braintree payment method based on Magento Payment Gateway, you can reed Magento of dev docs where all examples based on Braintree integration.

Also, check Braintree developers documentation overview, Magento Braintree integration follows it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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