$this->billable->request('PUT', sprintf('v1/subscriptions/%s', $this->id), $attributes))) ->setBillable($this->billable); } /** * Force given subscription to check out (trusted apps only). * * @throws Throwable */ public function checkout(): self { return (new self(fn() => $this->billable->request('PUT', sprintf('v1/subscriptions/%s/checkout', $this->id)))) ->setBillable($this->billable); } /** * Revoke a given running subscription from the current user. * * @throws Throwable */ public function revoke(bool $refund = false): self { $attributes = [ 'refund' => $refund, ]; return (new self(fn() => $this->billable->request('PUT', sprintf('v1/subscriptions/%s/revoke', $this->id), $attributes))) ->setBillable($this->billable); } /** * Pause a given running subscription from the current user. * * @throws Throwable */ public function pause(): self { return (new self(fn() => $this->billable->request('PUT', sprintf('v1/subscriptions/%s/pause', $this->id)))) ->setBillable($this->billable); } /** * Resume a given running subscription from the current user. * * @throws Throwable */ public function resume(): self { return (new self(fn() => $this->billable->request('PUT', sprintf('v1/subscriptions/%s/resume', $this->id)))) ->setBillable($this->billable); } /** * Delete a given subscription from the current user. * * @throws Throwable */ public function delete(): bool { return $this->billable->request('DELETE', sprintf('v1/subscriptions/%s', $this->id))->success(); } }