baseUrl = config('services.asaas.base_url'); // Allows overriding the API key for subaccounts $this->apiKey = $apiKey ?? config('services.asaas.api_key'); } protected function request(): PendingRequest { return Http::withHeaders([ 'access_token' => $this->apiKey, ])->baseUrl($this->baseUrl); } public function get(string $endpoint, array $query = []) { $response = $this->request()->get($endpoint, $query); if ($response->failed()) { throw new AsaasException($response); } return $response->json(); } public function post(string $endpoint, array $data = []) { $response = $this->request()->post($endpoint, $data); if ($response->failed()) { throw new AsaasException($response); } return $response->json(); } }