/**
  * Schedule the cancellation of the subscription. The reason may be provided as well.
  * @param string $cancelAt
  * @param string $cancellationReason
  * @param array $options
  * @return $this
  */
 public function cancelAtDate($cancelAt, $cancellationReason, $options = array())
 {
     $request = new Request($this->client);
     $path = "/subscriptions/" . urlencode($this->getId()) . "";
     $data = array("cancel_at" => $cancelAt, "cancellation_reason" => $cancellationReason);
     $response = $request->delete($path, $data, $options);
     $returnValues = array();
     // Handling for field subscription
     $body = $response->getBody();
     $body = $body['subscription'];
     $returnValues['cancelAtDate'] = $this->fillWithData($body);
     return array_values($returnValues)[0];
 }
Example #2
0
 /**
  * Delete the coupon.
  * @param array $options
  * @return bool
  */
 public function delete($options = array())
 {
     $request = new Request($this->client);
     $path = "/coupons/" . urlencode($this->getId()) . "";
     $data = array();
     $response = $request->delete($path, $data, $options);
     $returnValues = array();
     $returnValues['success'] = $response->isSuccess();
     return array_values($returnValues)[0];
 }