/** * Save the updated subscription attributes. * @param array $options * @return $this */ public function save($options = array()) { $request = new Request($this->client); $path = "/subscriptions/" . urlencode($this->getId()) . ""; $data = array("name" => $this->getName(), "amount" => $this->getAmount(), "interval" => $this->getInterval(), "trial_end_at" => $this->getTrialEndAt(), "metadata" => $this->getMetadata()); $response = $request->put($path, $data, $options); $returnValues = array(); // Handling for field subscription $body = $response->getBody(); $body = $body['subscription']; $returnValues['save'] = $this->fillWithData($body); return array_values($returnValues)[0]; }
/** * Save the updated coupon attributes. * @param array $options * @return $this */ public function save($options = array()) { $request = new Request($this->client); $path = "/coupons/" . urlencode($this->getId()) . ""; $data = array("metadata" => $this->getMetadata()); $response = $request->put($path, $data, $options); $returnValues = array(); // Handling for field coupon $body = $response->getBody(); $body = $body['coupon']; $returnValues['save'] = $this->fillWithData($body); return array_values($returnValues)[0]; }
/** * Save the updated product attributes. * @param array $options * @return $this */ public function save($options = array()) { $request = new Request($this->client); $path = "/products/" . urlencode($this->getId()) . ""; $data = array("name" => $this->getName(), "amount" => $this->getAmount(), "currency" => $this->getCurrency(), "metadata" => $this->getMetadata(), "request_email" => $this->getRequestEmail(), "request_shipping" => $this->getRequestShipping(), "return_url" => $this->getReturnUrl(), "cancel_url" => $this->getCancelUrl()); $response = $request->put($path, $data, $options); $returnValues = array(); // Handling for field product $body = $response->getBody(); $body = $body['product']; $returnValues['save'] = $this->fillWithData($body); return array_values($returnValues)[0]; }
/** * Save the updated customer attributes. * @param array $options * @return $this */ public function save($options = array()) { $request = new Request($this->client); $path = "/customers/" . urlencode($this->getId()) . ""; $data = array("balance" => $this->getBalance(), "email" => $this->getEmail(), "first_name" => $this->getFirstName(), "last_name" => $this->getLastName(), "address1" => $this->getAddress1(), "address2" => $this->getAddress2(), "city" => $this->getCity(), "state" => $this->getState(), "zip" => $this->getZip(), "country_code" => $this->getCountryCode(), "metadata" => $this->getMetadata()); $response = $request->put($path, $data, $options); $returnValues = array(); // Handling for field customer $body = $response->getBody(); $body = $body['customer']; $returnValues['save'] = $this->fillWithData($body); return array_values($returnValues)[0]; }
/** * Save the updated plan attributes. This action won't affect subscriptions already linked to this plan. * @param array $options * @return $this */ public function save($options = array()) { $request = new Request($this->client); $path = "/plans/" . urlencode($this->getId()) . ""; $data = array("name" => $this->getName(), "trial_period" => $this->getTrialPeriod(), "metadata" => $this->getMetadata(), "return_url" => $this->getReturnUrl(), "cancel_url" => $this->getCancelUrl()); $response = $request->put($path, $data, $options); $returnValues = array(); // Handling for field plan $body = $response->getBody(); $body = $body['plan']; $returnValues['save'] = $this->fillWithData($body); return array_values($returnValues)[0]; }