braintree / braintree_java

Braintree Java library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
158 stars 98 forks source link

braintree AuthorizationException #25

Closed rifnijeleel closed 9 years ago

rifnijeleel commented 9 years ago

If i pass merchantAccountId in the request it throws an exception but if you dont it doesnt happen. I think either error message should be more clear or it should just accept the merchantAccountId. TransactionRequest request = new TransactionRequest() .amount(new BigDecimal(""+amount)). merchantAccountId("testdfcc2f3w26rdff")

Exception in thread "main" com.braintreegateway.exceptions.AuthorizationException at com.braintreegateway.util.Http.throwExceptionIfErrorStatusCode(Http.java:196) at com.braintreegateway.util.Http.httpRequest(Http.java:94) at com.braintreegateway.util.Http.post(Http.java:56) at com.braintreegateway.TransactionGateway.sale(TransactionGateway.java:105) at com.mobiletopup.service.paymentgateway.BraintreePaymentService.takePayment(BraintreePaymentService.java:154) at com.mobiletopup.service.paymentgateway.BraintreePaymentService.main(BraintreePaymentService.java:90)

dewyze commented 9 years ago

@rifnijeleel You will see the AuthorizationException because it compares your keys to the merchant accounts you have access to. It is possible you could enter a valid merchantAccountId for another merchant, and so we return an AuthorizationException if you don't have proper access. (You will see this error regardless of whether a merchant account with that id exists or not).

dewyze commented 9 years ago

Closing. @rifnijeleel feel free to reopen if you have further questions.

simeyla commented 4 years ago

You get the same AuthorizationException error if you try to update a GooglePay expiration date using PaymentMethod.UpdateAsync - as opposed to a credit card. Wasn't expecting it to work, but would have expected a better error.

Don't have time to open an issue, but just wanted to add a note.