2

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?

Alex McCabe
  • 1,852
  • 2
  • 20
  • 33

1 Answers1

1

Hrm, it sounds like that you have hit a bug. Can I request that you log the details in the bug tracker on the omnipay-paypal github page? I'm one of the developers of the omnipay-paypal REST gateway so I will try to get onto a fix for this for you as soon as I'm able. Bring the bug details to my attention once you've logged it -- either here or on github.

delatbabel
  • 3,601
  • 24
  • 29
  • Unfortunately I abandoned OmniPay entirely as neither the Express checkout nor the REST implementation did as I required. I finally figured out the PayPal SDK so I've implemented that. Thank you for getting back to me though, but I no longer have any of my OmniPay code. – Alex McCabe Dec 14 '15 at 12:06