public function createBadge($data)
	{
		if (!$this->credentialsSet())
		{
			throw new Exception('You need to set the credentials first.');
		}

		$data['IssuerId'] = $this->credentials->issuerId;
		$data = json_encode($data);
		$accessToken = $this->credentials->access_token;
		$userAgent = $_SERVER['HTTP_USER_AGENT'];

		$headers = [
			'Cache-Control: no-cache',
			'Content-Type: application/json',
			"Authorization: Bearer $accessToken",
			"user-agent: $userAgent"
		];

		$request = curl_init();
		curl_setopt($request, CURLOPT_HTTPHEADER, $headers);
		curl_setopt($request, CURLOPT_URL, 'https://www.openpassport.org/1.0.0/badges');
		curl_setopt($request, CURLOPT_POSTFIELDS, $data);
		curl_setopt($request, CURLOPT_POST, 1);
		curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($request, CURLOPT_VERBOSE, true);

		$response = curl_exec($request);
		$badge = json_decode($response);

		if (empty($badge->Id) || !$badge->Id)
		{
			throw new Exception($badge->message);
		}

		return $badge->Id;
	}