No data is sent to WorldPay

551 Views Asked by At

Attempting to send a purchase to WorldPay results in a PurchaseResponse object being returned seemingly without any attempt being made to contact WorldPay servers?

Here's the code:

        $gateway = Omnipay::create('WorldPay');
        $gateway->setInstallationId('123456');
        $gateway->setTestMode(true);

        $data = array(
            'amount'    => '10.00',
            'card'      => array(
                'cvv'         => '123',
                'expiryMonth' => '6',
                'expiryYear'  => '2016',
                'number'      => '4242424242424242'
            ),
            'currency'  => 'GBP',
            'returnUrl' => 'http://returnurl.com'
        );
        $response = $gateway->purchase($data)->send();

A look through the code for the plugin shows no access being attempted to WorldPay servers. What am I missing?

1

There are 1 best solutions below

0
On

Per this github issue, no data is expected to be sent to worldpay:

https://github.com/omnipay/worldpay/issues/1

You're not missing anything. Worldpay doesn't require any server to server communication, the data is sent as query parameters by the client.

Following the omnipay conventions, it returns a redirect response. You can call $response->isRedirect() and $response->redirect() to send your customer to Worldpay with the correct URL.