I am trying to force an error in the PayPal Rest API using Omnipay, however the data I am getting returned is just an empty array.
The basics:
$this->gateway = Omnipay::create($config['method']);
$this->gateway->setTestMode($config['testMode']);
$this->gateway->setClientID($config['clientID']);
$this->gateway->setSecret($config['secret']);
$response = $this->gateway
->purchase($this->purchaseData)
->setItems($items)
->send();
$reference = $response->getTransactionReference();
Now, when clientID
and secret
are correct, I get a reference. But when I set the API details incorrectly and try to log the response using $response->getData()
I get an empty array.
$response->getMessage()
is similarly empty.
I obviously want to know what has gone wrong here and why the payment has failed to produce an error for the user.
Am I missing something, as all I can find is how to deal with working applications, I can't find any errors.
PayPals documentation states that they return a HTTP status code and a message saying what went wrong, I should be seeing that, surely?