private function getPaysafeException($httpCode, $message = null, $code = null)
    {
        if(!$message) {
            $message = "An unknown error has occurred.";
        }
        if(!$code) {
            $code = $httpCode;
        }

        $exceptionType = '\Paysafe\PaysafeException';
        switch($httpCode) {
            case '400':
                $exceptionType = '\Paysafe\InvalidRequestException';
                break;
            case '401':
                $exceptionType = '\Paysafe\InvalidCredentialsException';
                break;
            case '402':
                $exceptionType = '\Paysafe\RequestDeclinedException';
                break;
            case '403':
                $exceptionType = '\Paysafe\PermissionException';
                break;
            case '404':
                $exceptionType = '\Paysafe\EntityNotFoundException';
                break;
            case '409':
                $exceptionType = '\Paysafe\RequestConflictException';
                break;
            case '406':
            case '415':
                $exceptionType = '\Paysafe\APIException';
                break;
            default:
                if($httpCode >= 500) {
                    $exceptionType = '\Paysafe\APIException';
                }
                break;

        }

        return new $exceptionType($message,$code);
    }