Skip to main content

Total refund

Last updated: 06-Jun-2024
Rate this article:


Use the issueRefund method to issue a total refund for an order processed by 2Checkout.


The payment for the refundable order needs to be collected.

You cannot issue a refund for an amount higher than the total order amount.



$host = '';
$merchantCode = "MERCHANT_CODE"; // your account's merchant code available in the 'System settings' area of the cPanel:
$key = "SECRET_KEY"; // your account's secret key available in the 'System settings' area of the cPanel:

$now = gmdate('Y-m-d H:i:s'); //GMT date format)
$algo = "sha256";
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash = hash_hmac($algo, $string, $key);

try {
    $client = new SoapClient($host . "/soap/6.0/?wsdl", [
        'location'       => $host . "/soap/6.0/",
        "stream_context" => stream_context_create([
            'ssl' => [
                'verify_peer'      => false,
                'verify_peer_name' => false
    $sessionID = $client->login($merchantCode, $now, $hash, $algo);
    echo("Token: {$sessionID}" . PHP_EOL);

    $orderReference = "73152871";
    $items = [];
    $amount = '241.49';
    $comment = "This is a comment";
    $reason = "Fraud";

    $refundedOrder = $client->issueRefund($sessionID, $orderReference, $amount, $items, $comment, $reason);
} catch (SoapFault $e) {
    echo "Authentication: " . $e->getMessage() . PHP_EOL;


Response Type/Description

TRUE is the refund was processed successfully

FALSE otherwise


Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo