public function authorize($appId, $appKey = null, $credentials_or_service_id, $usage = null) {
    $url =  $this->getHost() . "/transactions/authorize.xml";
    $params = array('app_id' => $appId);

    if ($credentials_or_service_id instanceof ThreeScaleClientCredentials ) {
      $params['service_token'] = $credentials_or_service_id->service_token;
      $params['service_id'] = $credentials_or_service_id->service_id;
    } else {
      $params['provider_key'] = $this->getProviderKey();
      $params['service_id'] = $credentials_or_service_id;
    }

    if ($appKey) {
      $params['app_key'] = $appKey;
    }
    
    if ($usage) {
      $params['usage'] = $usage;
    }
    
    $httpResponse = $this->httpClient->get($url, $params);
    if (self::isHttpSuccess($httpResponse)) {
      return $this->buildAuthorizeResponse($httpResponse->body);
    } else {
      return $this->processError($httpResponse);
    }
  }