# 인증 관리

## 1. GetCertificatePopUpURL - 홈택스 인증정보 등록 팝업 URL

| HTTP Method | 테스트(Sandbox)                                            | 운영(Production)                                     |
| ----------- | ------------------------------------------------------- | -------------------------------------------------- |
| GET         | <https://popbill-test.linkhub.co.kr/HomeTax/Taxinvoice> | <https://popbill.linkhub.co.kr/HomeTax/Taxinvoice> |

![홈택스 인증정보 등록 팝업 URL 미리보기](https://developers.popbill.com/images/reference/httaxinvoice/getCertificatePopUpURL.png)

**홈택스 인증정보를 등록하는 팝업 URL을 반환합니다.**

- 권장 사이즈 : width = 800px / height = 660px
- 반환되는 URL은 30초 동안만 사용이 가능합니다.
- 반환되는 URL에서만 유효한 세션을 포함하고 있습니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/httaxinvoice/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Query 파라미터**

- TG `type: string` `length: -` `required: Y` `description: 고정값 : CERT`

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/HomeTax/Taxinvoice?TG=CERT' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- url `type: string` `length: -` `description: 홈택스 인증정보 등록 팝업 URL`

**응답 예시**

```json
{
    "url": "https://test.popbill.com/App/API?T=IRXSGITDREOTPOIRLPUHCB4BSBC4...NX7BMAR3="
}
```

## 2. GetCertificateExpireDate - 인증서 만료일자 확인

| HTTP Method | 테스트(Sandbox)                                                     | 운영(Production)                                              |
| ----------- | ---------------------------------------------------------------- | ----------------------------------------------------------- |
| GET         | <https://popbill-test.linkhub.co.kr/HomeTax/Taxinvoice/CertInfo> | <https://popbill.linkhub.co.kr/HomeTax/Taxinvoice/CertInfo> |

- 팝빌에 등록된 인증서의 만료일시를 확인합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/httaxinvoice/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/HomeTax/Taxinvoice/CertInfo' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- certificateExpiration `type: string` `length: 14` `description: 만료일시`
  - 형식 : yyyyMMddHHmmss

**응답 예시**

```json
{
    "certificateExpiration": "20251111204731"
}
```

## 3. CheckCertValidation - 인증서 유효성 검증

| HTTP Method | 테스트(Sandbox)                                                      | 운영(Production)                                               |
| ----------- | ----------------------------------------------------------------- | ------------------------------------------------------------ |
| GET         | <https://popbill-test.linkhub.co.kr/HomeTax/Taxinvoice/CertCheck> | <https://popbill.linkhub.co.kr/HomeTax/Taxinvoice/CertCheck> |

- 팝빌에 등록된 인증서로 홈택스 로그인 가능 여부를 확인합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/httaxinvoice/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/HomeTax/Taxinvoice/CertCheck' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- code `type: number` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`

**응답 예시**

```json
{
    "code": 1,
    "message": "로그인 성공"
}
```

## 4. RegistDeptUser - 부서사용자 계정 등록

| HTTP Method | 테스트(Sandbox)                                                     | 운영(Production)                                              |
| ----------- | ---------------------------------------------------------------- | ----------------------------------------------------------- |
| POST        | <https://popbill-test.linkhub.co.kr/HomeTax/Taxinvoice/DeptUser> | <https://popbill.linkhub.co.kr/HomeTax/Taxinvoice/DeptUser> |

- 팝빌에 전자세금계산서 전용 부서사용자를 등록합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/httaxinvoice/getting-started/authorization)
- Content-Type `required: Y` `description: 요청 본문 형식`
  - `application/json`
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**요청 본문**

- id `type: string` `length: 50` `required: Y` `description: 부서사용자 아이디`
- pwd `type: string` `length: 50` `required: Y` `description: 부서사용자 비밀번호`
- secAuth `type: string` `length: 7` `required: Y` `description: 부서사용자 대표자 주민번호`
  - 주민번호 앞 7자리(생년월일 6자리+ 성별구분 1자리) 홈택스에서 2차인증이 설정된 경우만 입력하고, 해제된 경우 null 또는 ""(공백)을 입력

**요청 예시**

```bash
curl --request POST \
  --url 'https://{domain}/HomeTax/Taxinvoice/DeptUser' \
  --header 'Authorization: Bearer {token}' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "부서사용자 아이디",
    "pwd": "부서사용자 비밀번호",
    "secAuth": "부서사용자 대표자 주민번호"
  }'
```

### Response

**응답 본문**

- code `type: number` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`

**응답 예시**

```json
{
    "code": 1,
    "message": "처리 완료"
}
```

## 5. CheckDeptUser - 부서사용자 등록 여부

| HTTP Method | 테스트(Sandbox)                                                     | 운영(Production)                                              |
| ----------- | ---------------------------------------------------------------- | ----------------------------------------------------------- |
| GET         | <https://popbill-test.linkhub.co.kr/HomeTax/Taxinvoice/DeptUser> | <https://popbill.linkhub.co.kr/HomeTax/Taxinvoice/DeptUser> |

- 팝빌에 부서사용자 등록 여부를 확인합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/httaxinvoice/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/HomeTax/Taxinvoice/DeptUser' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- code `type: number` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`

**응답 예시**

```json
{
    "code": 1,
    "message": "처리 완료"
}
```

## 6. CheckLoginDeptUser - 부서사용자 유효성 검증

| HTTP Method | 테스트(Sandbox)                                                           | 운영(Production)                                                    |
| ----------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------- |
| GET         | <https://popbill-test.linkhub.co.kr/HomeTax/Taxinvoice/DeptUser/Check> | <https://popbill.linkhub.co.kr/HomeTax/Taxinvoice/DeptUser/Check> |

- 팝빌에 등록된 부서사용자로 홈택스 로그인 가능 여부를 확인합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/httaxinvoice/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/HomeTax/Taxinvoice/DeptUser/Check' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- code `type: number` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`

**응답 예시**

```json
{
    "code": 1,
    "message": "로그인 성공"
}
```

## 7. DeleteDeptUser - 부서사용자 계정 삭제

| HTTP Method | 테스트(Sandbox)                                                     | 운영(Production)                                              |
| ----------- | ---------------------------------------------------------------- | ----------------------------------------------------------- |
| POST        | <https://popbill-test.linkhub.co.kr/HomeTax/Taxinvoice/DeptUser> | <https://popbill.linkhub.co.kr/HomeTax/Taxinvoice/DeptUser> |

- 팝빌에 등록된 부서사용자 계정을 삭제합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/httaxinvoice/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-HTTP-Method-Override `required: Y` `description: 요청 메서드 재정의`
  - `DELETE`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**요청 예시**

```bash
curl --request POST \
  --url 'https://{domain}/HomeTax/Taxinvoice/DeptUser' \
  --header 'Authorization: Bearer {token}' \
  --header 'X-HTTP-Method-Override: DELETE'
```

### Response

**응답 본문**

- code `type: number` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`

**응답 예시**

```json
{
    "code": 1,
    "message": "삭제 완료"
}
```
