Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Refunding an order

Alexander Vizhanov edited this page Apr 27, 2017 · 3 revisions
// Create a gateway for the WorldPay Gateway
// (routes to GatewayFactory::create)
$gateway = Omnipay::create('\\lembdev\\WorldPay\\Gateway');

// Initialise the gateway
$gateway->initialize([
    'serviceKey' => 'MyServiceKey',
    'clientKey'  => 'MyClientKey',
]);

// Do a purchase transaction on the gateway
$transaction = $gateway->refund([
    'orderCode' => 'ORDER_CODE'
]);

$response = $transaction->send();
if ($response->isSuccessful()) {
    echo "Refund transaction was successful!\n";
} else {
    echo $response->getMessage();
}
Clone this wiki locally