6

I'm setting up Braintree payment In Magento 2 environment through integrated extension provided by Magento.

I have compiled the backend form with my merchant data and i selected sandox option to test all. All seems to work, Braintree payment option appear in my store frontend, I tried to do a payment with credit card datas provided by braintree, but when I click on checkout button, I receive this error message:

There was an error capturing the transaction: Please try again later.

If i debug the request with my browser developer tool I receive a 400 Bad Request response from this API:

http://MYSITE.SITE/rest/default/V1/guest-carts/XXXXXXX/payment-information

with this stack trace into the response request:

 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(80): Magento\Braintree\Model\PaymentMethod->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), '101')
 n#1 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Payment/Processor.php(85): Magento\Sales\Model\Order\Payment\Operations\CaptureOperation->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), Object(Magento\Sales\Model\Order\Invoice))
 n#2 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Payment.php(435): Magento\Sales\Model\Order\Payment\Processor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), Object(Magento\Sales\Model\Order\Invoice))
 n#3 /var/www/html/magento2/var/generation/Magento/Sales/Model/Order/Payment/Interceptor.php(167): Magento\Sales\Model\Order\Payment->capture(Object(Magento\Sales\Model\Order\Invoice))
 n#4 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Invoice.php(341): Magento\Sales\Model\Order\Payment\Interceptor->capture(Object(Magento\Sales\Model\Order\Invoice))
 n#5 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Payment/Operations/AbstractOperation.php(70): Magento\Sales\Model\Order\Invoice->capture()
 n#6 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(30): Magento\Sales\Model\Order\Payment\Operations\AbstractOperation->invoice(Object(Magento\Sales\Model\Order\Payment\Interceptor))
 n#7 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Payment/Processor.php(85): Magento\Sales\Model\Order\Payment\Operations\CaptureOperation->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), NULL)
 n#8 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Payment.php(435): Magento\Sales\Model\Order\Payment\Processor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), NULL)
 n#9 /var/www/html/magento2/var/generation/Magento/Sales/Model/Order/Payment/Interceptor.php(167): Magento\Sales\Model\Order\Payment->capture(NULL)
 n#10 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Payment.php(416): Magento\Sales\Model\Order\Payment\Interceptor->capture(NULL)
 n#11 /var/www/html/magento2/vendor/magento/module-sales/Model/Order/Payment.php(336): Magento\Sales\Model\Order\Payment->processAction('authorize_captu...', Object(Magento\Sales\Model\Order))
 n#12 /var/www/html/magento2/var/generation/Magento/Sales/Model/Order/Payment/Interceptor.php(154): Magento\Sales\Model\Order\Payment->place()
 n#13 /var/www/html/magento2/vendor/magento/module-sales/Model/Order.php(871): Magento\Sales\Model\Order\Payment\Interceptor->place()
 n#14 /var/www/html/magento2/vendor/magento/module-sales/Model/Order.php(1060): Magento\Sales\Model\Order->_placePayment()
 n#15 /var/www/html/magento2/vendor/magento/module-sales/Model/Service/OrderService.php(190): Magento\Sales\Model\Order->place()
 n#16 /var/www/html/magento2/vendor/magento/module-quote/Model/QuoteManagement.php(491): Magento\Sales\Model\Service\OrderService->place(Object(Magento\Sales\Model\Order))
 n#17 /var/www/html/magento2/vendor/magento/module-quote/Model/QuoteManagement.php(394): Magento\Quote\Model\QuoteManagement->submitQuote(Object(Magento\Quote\Model\Quote), Array)
 n#18 /var/www/html/magento2/vendor/magento/module-quote/Model/QuoteManagement.php(354): Magento\Quote\Model\QuoteManagement->submit(Object(Magento\Quote\Model\Quote))
 n#19 /var/www/html/magento2/vendor/magento/module-quote/Model/GuestCart/GuestCartManagement.php(87): Magento\Quote\Model\QuoteManagement->placeOrder('12', NULL)
 n#20 /var/www/html/magento2/vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php(79): Magento\Quote\Model\GuestCart\GuestCartManagement->placeOrder('99fb88573f13cc3...')
 n#21 [internal function]: Magento\Checkout\Model\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder('99fb88573f13cc3...', 'alberto.gardena...', Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address))
 n#22 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(265): call_user_func_array(Array, Array)
 n#23 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(160): Magento\Webapi\Controller\Rest->processApiRequest()
 n#24 /var/www/html/magento2/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(24): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
 n#25 /var/www/html/magento2/vendor/magento/framework/App/Http.php(115): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
 n#26 /var/www/html/magento2/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
 n#27 /var/www/html/magento2/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
 n#28 {main}

Has someone got the solution about this problem?

Thank you!

5
  • I have the same problem as well, but not with Braintree but just with the basic Bank transfer payment method. And only in production on in develop mode. Sep 19, 2016 at 7:03
  • have you found any solution? Jan 23, 2017 at 8:30
  • have you cleared cache and generation folder ? php bin/magento setup:upgrade && php bin/magento cache:clean Apr 12, 2017 at 15:29
  • Are you facing customer login issue along with this issue May 22, 2017 at 9:28
  • hi @alberto i have faced the same issue while setup the braintree sandbox details please remove the merchant id and check it now. prntscr.com/fmow47 Jun 22, 2017 at 4:14

1 Answer 1

2

I have tried in my local magento 2 and setup the Braintree Sandbox details.

Please follow the below screenshots:

Admin end settings:

Admin end settings

Admin end settings:

Admin end settings Onestep checkout page :

Onestep checkout page

After place order processing :

After place order processing

Success page: Success page

Order view admin end :

Order view admin end Transaction details in the braintree site :

enter image description here

Note: When we give specify the merchant id in the admin end, it shows bad request error in the frontend.

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