src/main/php/com-realexpayments-hpp-sdk/RealexHpp.php
public function responseToJson(HppResponse $hppResponse)
    {

        $this->logger->info("Converting HppResponse to JSON.");

        $json = null;

        //generate hash
        $this->logger->debug("Generating hash.");
        $hppResponse->hash($this->secret);

        //encode
        $this->logger->debug("Encoding object.");
        try {
            $hppResponse = $hppResponse->encode(self::ENCODING_CHARSET);
        } catch (Exception $e) {
            $this->logger->error("Exception encoding HPP response.", $e);
            throw new RealexException("Exception encoding HPP response.", $e);
        }

        //convert to JSON
        $this->logger->debug("Converting to JSON.");
        $json = JsonUtils::toJson($hppResponse);

        return $json;
    }
public function responseToJson(HppResponse $hppResponse)
    {

        $this->logger->info("Converting HppResponse to JSON.");

        $json = null;

        //generate hash
        $this->logger->debug("Generating hash.");
        $hppResponse->hash($this->secret);

        //encode
        $this->logger->debug("Encoding object.");
        try {
            $hppResponse = $hppResponse->encode(self::ENCODING_CHARSET);
        } catch (Exception $e) {
            $this->logger->error("Exception encoding HPP response.", $e);
            throw new RealexException("Exception encoding HPP response.", $e);
        }

        //convert to JSON
        $this->logger->debug("Converting to JSON.");
        $json = JsonUtils::toJson($hppResponse);

        return $json;
    }
<p>
Method produces JSON from <code>HppResponse</code> object.
Carries out the following actions:
<ul>
<li>Validates inputs</li>
<li>Generates defaults for security hash, order ID and time stamp (if required)</li>
<li>Base64 encodes inputs</li>
<li>Serialises response object to JSON</li>
</ul>
</p>

@param HppResponse $hppResponse
@return string