diff --git a/src/Message/Response.php b/src/Message/Response.php index 28ec80d1..a94e1e71 100644 --- a/src/Message/Response.php +++ b/src/Message/Response.php @@ -55,13 +55,29 @@ public function isSuccessful() */ public function getChargeReference() { - if (isset($this->data['object']) && $this->data['object'] == 'charge') { + if (isset($this->data['object']) && 'charge' === $this->data['object']) { return $this->data['id']; } return null; } + /** + * Get the outcome of a charge from the response + * + * @return array|null + */ + public function getOutcome() + { + if (isset($this->data['object']) && 'charge' === $this->data['object']) { + if (isset($this->data['outcome']) && !empty($this->data['outcome'])) { + return $this->data['outcome']; + } + } + + return null; + } + /** * Get the transaction reference. *