braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
546 stars 224 forks source link

Transaction::sale does not return error for Processor Decline #248

Closed chandon closed 5 years ago

chandon commented 5 years ago

General information

Issue description

When running a Transaction::sale resulting in a Processor Decline, according to the documentation (https://developers.braintreepayments.com/reference/general/result-objects/php) , i should retrieve errors with

$result->errors->deepAll()

But there is no error returned.

I can see the Processor Response Code by getting code from transaction :

$result->transaction : { "processorResponseCode" : 2001, "processorResponseText" : "Insufficient Funds" ... }

The decline should be reported in errors too...

crookedneighbor commented 5 years ago

The errors result object will only be populated if the error is due to a failed validation. In this case, the object will contain one or more validation errors indicating which parameters were invalid:

In this case, the decline is not a validation error, so I wouldn't expect it to be there.