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

Partially 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 refund transaction on the gateway
$transaction = $gateway->refund([
    'orderCode'    => 'ORDER_CODE',
    'refundAmount' => 10.00
]);

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