braintree / braintree_dotnet

Braintree .NET library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
136 stars 73 forks source link

Braintree.Exceptions.UnexpectedException: Exception of type 'Braintree.Exceptions.UnexpectedException' was thrown #138

Closed gsckoco closed 7 months ago

gsckoco commented 7 months ago

General information

Issue description

When trying to process a payment with gateway.Transaction.Sale(tranRequest); a Braintree.Exception.UnexpectedException is thrown.

Full exception is: Source: Unexpected HTTP_RESPONSE BadRequest (Not part of the stack trace)

Braintree.Exceptions.UnexpectedException: Exception of type 'Braintree.Exceptions.UnexpectedException' was thrown.
   at Braintree.HttpService.ThrowExceptionIfErrorStatusCode(HttpStatusCode httpStatusCode, String message)
   at Braintree.HttpService.GetHttpResponse(HttpWebRequest request)
   at Braintree.BraintreeService.GetXmlResponse(String URL, String method, Request requestBody, FileStream file)
   at Braintree.TransactionGateway.Sale(TransactionRequest request)
   at BraintreePayments.redacted.Process(Object sender, EventArgs e) in C:\Projects\braintreePayments\BraintreePayments\redacted.cs:line 213

TransactionRequest Object

I was unable to find anyone with a similar error, or any steps on how to begin debugging short cloning this repo and inserting my own debug logic.

Any help would be greatly appreciated.

gsckoco commented 7 months ago

Rubber duck debugging, turns out the names of the metadata fields I was sent were not correct.