Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Braintree in production modus not working #8154

Closed
amansilla opened this issue Jan 16, 2017 · 16 comments
Closed

Braintree in production modus not working #8154

amansilla opened this issue Jan 16, 2017 · 16 comments
Assignees
Labels
Component: Payment Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Progress: needs update

Comments

@amansilla
Copy link

amansilla commented Jan 16, 2017

Braintree not working in production mode, whenever I select "Credit Card (Braintree)" a JS error will occur.

Preconditions

  1. Magento 2.1.2

Steps to reproduce

  1. Add product to the cart
  2. Go to checkout
  3. Select Braintree as payment method

Expected result

  1. Be able to introduce the credit card information

Actual result

  1. Uncaught Error: Braintree API Client Misconfigured: clientToken required.
@joni-jones
Copy link
Contributor

Hi, @amansilla, looks like you did not configure Braintree payment method in Magento admin panel. Did you specify Merchant ID, Public Key and Private Key for Braintree?

@amansilla
Copy link
Author

Hi @joni-jones thanks for your quick feedback. Yes, for sure I provided the ´Merchant ID´, ´Public Key´ and ´Private Key´. I'm guessing that JS is not be able to get the clientToken because I'm running it in a VM and Braintreee maybe check the domain name doing the request.

I'll report the result of my test asap.

@joni-jones
Copy link
Contributor

You can also use xdebug to check if getClientToken method returns token.

@amansilla
Copy link
Author

amansilla commented Jan 18, 2017

Yes, I did it and getClientToken return always null. I'm still researching it why right now but I guess it's a bug.

@joni-jones
Copy link
Contributor

joni-jones commented Jan 18, 2017

The \Magento\Braintree\Model\Adapter\BraintreeAdapter::generate returns null if token generation fails with exception. In this method you can find original reason of failing, please, post this exception message with stack trace.

@amansilla
Copy link
Author

I know but take a look here that the generate is called without params. https://github.com/magento/magento2/blob/2.1.2/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php#L116 😄

@joni-jones
Copy link
Contributor

So? In 2.1.2 version token generation does not use merchant account id (this param added in 2.1.3 version), but it anyway token will be generated without any params.

@amansilla
Copy link
Author

In my case and it's important with production credentials it's not being generated. Why? I've no clue.

@joni-jones
Copy link
Contributor

Did you try to set breakpoint in BrainteeAdapter::generate?

@amansilla
Copy link
Author

I debugged the BrainteeAdapter::generate and there during ClientToken::generate a exception will be thrown since a 401 HTTP status is returned back when doing the POST request .

@joni-jones
Copy link
Contributor

401 HTTP status says what request not authorized. Can you check your credentials in request to Braintree, also, you can check direct response from Braintree in \Braintree\Http::post.

@amansilla
Copy link
Author

amansilla commented Jan 18, 2017

ok sorry for disturbing here I got this working so you can close this. The problem was not magento related but braintree credential configuration, it seems the checkbox Authorize API was not checked.

@joni-jones thx for your help 😉

@joni-jones
Copy link
Contributor

You are welcome. I'm closing this issue as not a bug.

@sunilit42
Copy link
Contributor

@amansilla
i am facing same issue and there is no setting for like that as you mention like Authorize API checkbox

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Sep 16, 2017
@mytran89
Copy link

mytran89 commented Mar 1, 2018

hi @sunilit42 @amansilla , I'm also having this issue in production mode and didn't see any Authorize API checkbox either. Did you come up with any fix for it then?

@lano-vargas
Copy link

@amansilla similar issue ref: #5910

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Payment Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Progress: needs update
Projects
None yet
Development

No branches or pull requests

7 participants