public function cancelSubscription($subscriptionID, $cancelReason) {
    if ($subscriptionID != null && is_numeric($subscriptionID) && isset($cancelReason) && is_numeric($cancelReason)) {
      $url = $this->url . str_replace(":subscriptionID", $subscriptionID, Connect2PayClient::$API_ROUTES['SUB_CANCEL']);
      $trans = array();
      $trans['apiVersion'] = $this->apiVersion;
      $trans['cancelReason'] = intval($cancelReason);

      $result = $this->doPost($url, json_encode($trans));

      if ($result != null && is_array($result)) {
        $this->clientErrorMessage = $result['message'];
        return $result['code'];
      }
    } else {
      $this->clientErrorMessage = 'subscriptionID and cancelReason must be not null and numeric';
    }

    return null;
  }
public function cancelSubscription($subscriptionID, $cancelReason) {
    if ($subscriptionID != null && is_numeric($subscriptionID) && isset($cancelReason) && is_numeric($cancelReason)) {
      $url = $this->url . str_replace(":subscriptionID", $subscriptionID, Connect2PayClient::$API_ROUTES['SUB_CANCEL']);
      $trans = array();
      $trans['apiVersion'] = $this->apiVersion;
      $trans['cancelReason'] = intval($cancelReason);

      $result = $this->doPost($url, json_encode($trans));

      if ($result != null && is_array($result)) {
        $this->clientErrorMessage = $result['message'];
        return $result['code'];
      }
    } else {
      $this->clientErrorMessage = 'subscriptionID and cancelReason must be not null and numeric';
    }

    return null;
  }
public function cancelSubscription ( $ subscriptionID , $ cancelReason ) { if ( $ subscriptionID != null && is_numeric ( $ subscriptionID ) && isset ( $ cancelReason ) && is_numeric ( $ cancelReason ) ) { $ url = $ this -> url . str_replace ( ":subscriptionID" , $ subscriptionID , Connect2PayClient :: $ API_ROUTES [ 'SUB_CANCEL' ] ) ; $ trans = array ( ) ; $ trans [ 'apiVersion' ] = $ this -> apiVersion ; $ trans [ 'cancelReason' ] = intval ( $ cancelReason ) ; $ result = $ this -> doPost ( $ url , json_encode ( $ trans ) ) ; if ( $ result != null && is_array ( $ result ) ) { $ this -> clientErrorMessage = $ result [ 'message' ] ; return $ result [ 'code' ] ; } } else { $ this -> clientErrorMessage = 'subscriptionID and cancelReason must be not null and numeric' ; } return null ; }
Do a subscription cancellation.

@param int $subscriptionID
Identifier of the subscription to cancel
@param int $cancelReason
Identifier of the cancelReason (see _SUBSCRIPTION_CANCEL_*
constants)
@return string The result code of the operation (200 for success) or null
on
failure
Do a subscription cancellation .