Api.php
function createMerchantSignatureNotif($key, $data)
    {
        $key = $this->decodeBase64($key);
        $decodec = $this->base64_url_decode($data);
        $orderData = json_decode($decodec, true);
        $key = $this->encrypt_3DES($orderData['Ds_Order'], $key);
        $res = $this->mac256($data, $key);

        return $this->base64_url_encode($res);
    }
function createMerchantSignatureNotif($key, $data)
    {
        $key = $this->decodeBase64($key);
        $decodec = $this->base64_url_decode($data);
        $orderData = json_decode($decodec, true);
        $key = $this->encrypt_3DES($orderData['Ds_Order'], $key);
        $res = $this->mac256($data, $key);

        return $this->base64_url_encode($res);
    }
builds signature from the data sent by Redsys in the reply

@param $key
@param $data
@return string