# 정보확인

## 1. GetInfo - 상태 확인

세금계산서 1건의 상태 및 요약정보를 확인합니다.

- 응답 객체 PBTIInfo 의 변수 ‘stateCode’를 통해 세금계산서의 상태코드를 확인합니다. [\[참고\] 팝빌 상태코드](https://developers.popbill.com/reference/taxinvoice/vba/response-code#state-code)

```vb
Function GetInfo(CorpNum As String, KeyType As MgtKeyType, MgtKey As String, Optional UserID As String = "") As PBTIInfo
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- KeyType `type: MgtKeyType` `length: -` `required: Y` `description: 문서번호 유형 (택 1)`
  - `SELL`: 매출
  - `BUY`: 매입
  - `TRUSTEE`: 위수탁
- MgtKey `type: String` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**PBTIInfo**

- itemKey `type: String` `length: 18` `description: 팝빌에서 할당한 식별번호`
- taxType `type: String` `length: 2` `description: 과세형태`
  - `과세`
  - `영세`
  - `면세`
- writeDate `type: String` `length: 8` `description: 작성일자`
  - 형식 : yyyyMMdd
- regDT `type: String` `length: 14` `description: 임시저장 일시`
  - 형식 : yyyyMMddHHmmss
- issueType `type: String` `length: 3` `description: 발행형태`
  - `정발행`
  - `역발행`
  - `위수탁`
- supplyCostTotal `type: String` `length: 18` `description: 공급가액 합계`
- taxTotal `type: String` `length: 18` `description: 세액 합계`
- purposeType `type: String` `length: 2` `description: 영수/청구`
  - `영수`
  - `청구`
  - `없음`
- issueDT `type: String` `length: 14` `description: 발행일시`
  - 형식 : yyyyMMddHHmmss
- lateIssueYN `type: Boolean` `length: -` `description: 지연발행 여부`
  - `True`: 지연발행
  - `False`: 정상발행
- preIssueDT `type: String` `length: 14` `description: 발행예정일시`
  - 형식 : yyyyMMddHHmmss
- openYN `type: Boolean` `length: -` `description: 개봉 여부`
  - `True`: 개봉
  - `False`: 미개봉
  - {issueType}="정발행" or "위수탁" 경우 공급받는자가 세금계산서 보기 버튼을 클릭한 경우 개봉 처리
  - {issueType}="역발행" 경우 공급자가 세금계산서 보기 버튼을 클릭한 경우 개봉 처리
- openDT `type: String` `length: 14` `description: 개봉일시`
  - 형식 : yyyyMMddHHmmss
- stateMemo `type: String` `length: 200` `description: 상태메모`
- stateCode `type: Integer` `length: 3` `description: 상태코드`
  - [\[참고\] 팝빌 상태코드](https://developers.popbill.com/reference/taxinvoice/vba/response-code#state-code)
- stateDT `type: String` `length: 14` `description: 상태 변경일시`
  - 형식 : yyyyMMddHHmmss
- ntsconfirmNum `type: String` `length: 24` `description: 국세청승인번호`
  - 전자세금계산서 발행 시점에 팝빌에서 자동으로 할당
- ntsresult `type: String` `length: 6` `description: 국세청 전송결과`
- ntssendDT `type: String` `length: 14` `description: 국세청 전송일시`
  - 형식 : yyyyMMddHHmmss
- ntsresultDT `type: String` `length: 14` `description: 국세청 결과 수신일시`
  - 형식 : yyyyMMddHHmmss
- ntssendErrCode `type: String` `length: 8` `description: 국세청 결과코드`
  - [\[참고\] 국세청 결과코드](https://developers.popbill.com/reference/taxinvoice/vba/response-code#nts-result)
- modifyCode `type: Integer` `length: 1` `description: 수정세금계산서 발행시 입력한 사유코드`
  - [\[참고\] 수정세금계산서](https://developers.popbill.com/guide/taxinvoice/introduction/modified-taxinvoice)
- interOPYN `type: Boolean` `length: -` `description: 연동문서 여부`
  - `True`: API를 통해 발행한 연동문서
  - `False`: 팝빌 사이트를 통해 발행한 문서
- invoicerCorpName `type: String` `length: 200` `description: 공급자 상호`
- invoicerCorpNum `type: String` `length: 10` `description: 공급자 사업자번호`
- invoicerMgtKey `type: String` `length: 24` `description: 파트너가 팝빌에 세금계산서를 임시저장 또는 발행시 할당한 문서번호`
- invoicerPrintYN `type: Boolean` `length: -` `description: 공급자 인쇄여부`
  - `True`: 인쇄
  - `False`: 미인쇄
- invoiceeCorpName `type: String` `length: 200` `description: 공급받는자 상호`
- invoiceeCorpNum `type: String` `length: 13` `description: 공급받는자 사업자번호`
- invoiceeMgtKey `type: String` `length: 24` `description: 파트너가 할당한 문서번호`
- invoiceePrintYN `type: Boolean` `length: -` `description: 공급받는자 인쇄여부`
  - `True`: 인쇄
  - `False`: 미인쇄
- closeDownState `type: Integer` `length: 1` `description: 공급받는자 휴폐업상태`
  - `null`: 미확인
  - `0`: 미등록
  - `1`: 사업중
  - `2`: 폐업
  - `3`: 휴업
  - `4`: 확인실패
- closeDownStateDate `type: String` `length: 8` `description: 공급받는자 휴폐업일자`
  - 형식 : yyyyMMdd
- trusteeCorpName `type: String` `length: 200` `description: 수탁자 상호`
- trusteeCorpNum `type: String` `length: 10` `description: 수탁자 사업자번호`
- trusteeMgtKey `type: String` `length: 24` `description: 파트너가 할당한 문서번호`
- trusteePrintYN `type: Boolean` `length: -` `description: 수탁자 인쇄여부`
  - `True`: 인쇄
  - `False`: 미인쇄

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 2. GetInfos - 다수건 상태 확인

다수건의 세금계산서 상태 및 요약 정보를 확인합니다. (1회 호출에 최대 1,000건 확인 가능)

- 리턴값 PBTIInfo 의 변수 ‘stateCode’를 통해 세금계산서의 상태코드를 확인합니다. [\[참고\] 팝빌 상태코드](https://developers.popbill.com/reference/taxinvoice/vba/response-code#state-code)

```vb
Function GetInfos(CorpNum As String, KeyType As MgtKeyType, MgtKeyList As Collection, Optional UserID As String = "") As Collection
```

> 문서번호를 통해 세금계산서 목록을 구현하는 경우 활용합니다.

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- KeyType `type: MgtKeyType` `length: -` `required: Y` `description: 문서번호 유형 (택 1)`
  - `SELL`: 매출
  - `BUY`: 매입
  - `TRUSTEE`: 위수탁
- MgtKeyList `type: Collection` `length: 1,000` `required: Y` `description: 문서번호 목록`
  - 최대 : 1,000건
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**PBTIInfo**

- itemKey `type: String` `length: 18` `description: 팝빌에서 할당한 식별번호`
- taxType `type: String` `length: 2` `description: 과세형태`
  - `과세`
  - `영세`
  - `면세`
- writeDate `type: String` `length: 8` `description: 작성일자`
  - 형식 : yyyyMMdd
- regDT `type: String` `length: 14` `description: 임시저장 일시`
  - 형식 : yyyyMMddHHmmss
- issueType `type: String` `length: 3` `description: 발행형태`
  - `정발행`
  - `역발행`
  - `위수탁`
- supplyCostTotal `type: String` `length: 18` `description: 공급가액 합계`
- taxTotal `type: String` `length: 18` `description: 세액 합계`
- purposeType `type: String` `length: 2` `description: 영수/청구`
  - `영수`
  - `청구`
  - `없음`
- issueDT `type: String` `length: 14` `description: 발행일시`
  - 형식 : yyyyMMddHHmmss
- lateIssueYN `type: Boolean` `length: -` `description: 지연발행 여부`
  - `True`: 지연발행
  - `False`: 정상발행
- preIssueDT `type: String` `length: 14` `description: 발행예정일시`
  - 형식 : yyyyMMddHHmmss
- openYN `type: Boolean` `length: -` `description: 개봉 여부`
  - `True`: 개봉
  - `False`: 미개봉
  - {issueType}="정발행" or "위수탁" 경우 공급받는자가 세금계산서 보기 버튼을 클릭한 경우 개봉 처리
  - {issueType}="역발행" 경우 공급자가 세금계산서 보기 버튼을 클릭한 경우 개봉 처리
- openDT `type: String` `length: 14` `description: 개봉일시`
  - 형식 : yyyyMMddHHmmss
- stateMemo `type: String` `length: 200` `description: 상태메모`
- stateCode `type: Integer` `length: 3` `description: 상태코드`
  - [\[참고\] 팝빌 상태코드](https://developers.popbill.com/reference/taxinvoice/vba/response-code#state-code)
- stateDT `type: String` `length: 14` `description: 상태 변경일시`
  - 형식 : yyyyMMddHHmmss
- ntsconfirmNum `type: String` `length: 24` `description: 국세청승인번호`
  - 전자세금계산서 발행 시점에 팝빌에서 자동으로 할당
- ntsresult `type: String` `length: 6` `description: 국세청 전송결과`
- ntssendDT `type: String` `length: 14` `description: 국세청 전송일시`
  - 형식 : yyyyMMddHHmmss
- ntsresultDT `type: String` `length: 14` `description: 국세청 결과 수신일시`
  - 형식 : yyyyMMddHHmmss
- ntssendErrCode `type: String` `length: 8` `description: 국세청 결과코드`
  - [\[참고\] 국세청 결과코드](https://developers.popbill.com/reference/taxinvoice/vba/response-code#nts-result)
- modifyCode `type: Integer` `length: 1` `description: 수정세금계산서 발행시 입력한 사유코드`
  - [\[참고\] 수정세금계산서](https://developers.popbill.com/guide/taxinvoice/introduction/modified-taxinvoice)
- interOPYN `type: Boolean` `length: -` `description: 연동문서 여부`
  - `True`: API를 통해 발행한 연동문서
  - `False`: 팝빌 사이트를 통해 발행한 문서
- invoicerCorpName `type: String` `length: 200` `description: 공급자 상호`
- invoicerCorpNum `type: String` `length: 10` `description: 공급자 사업자번호`
- invoicerMgtKey `type: String` `length: 24` `description: 파트너가 팝빌에 세금계산서를 임시저장 또는 발행시 할당한 문서번호`
- invoicerPrintYN `type: Boolean` `length: -` `description: 공급자 인쇄여부`
  - `True`: 인쇄
  - `False`: 미인쇄
- invoiceeCorpName `type: String` `length: 200` `description: 공급받는자 상호`
- invoiceeCorpNum `type: String` `length: 13` `description: 공급받는자 사업자번호`
- invoiceeMgtKey `type: String` `length: 24` `description: 파트너가 할당한 문서번호`
- invoiceePrintYN `type: Boolean` `length: -` `description: 공급받는자 인쇄여부`
  - `True`: 인쇄
  - `False`: 미인쇄
- closeDownState `type: Integer` `length: 1` `description: 공급받는자 휴폐업상태`
  - `null`: 미확인
  - `0`: 미등록
  - `1`: 사업중
  - `2`: 폐업
  - `3`: 휴업
  - `4`: 확인실패
- closeDownStateDate `type: String` `length: 8` `description: 공급받는자 휴폐업일자`
  - 형식 : yyyyMMdd
- trusteeCorpName `type: String` `length: 200` `description: 수탁자 상호`
- trusteeCorpNum `type: String` `length: 10` `description: 수탁자 사업자번호`
- trusteeMgtKey `type: String` `length: 24` `description: 파트너가 할당한 문서번호`
- trusteePrintYN `type: Boolean` `length: -` `description: 수탁자 인쇄여부`
  - `True`: 인쇄
  - `False`: 미인쇄

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 3. GetDetailInfo - 상세정보 확인

세금계산서 1건의 상세정보를 확인합니다.

```vb
Function GetDetailInfo(CorpNum As String, KeyType As MgtKeyType, MgtKey As String, Optional UserID As String = "") As PBTaxinvoice
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- KeyType `type: MgtKeyType` `length: -` `required: Y` `description: 문서번호 유형 (택 1)`
  - `SELL`: 매출
  - `BUY`: 매입
  - `TRUSTEE`: 위수탁
- MgtKey `type: String` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**PBTaxinvoice**

- ntsconfirmNum `type: String` `length: 24` `description: 국세청승인번호`
  - 전자세금계산서 발행 시점에 팝빌에서 자동으로 할당
- issueType `type: String` `length: 3` `description: 발행형태`
  - `정발행`
  - `역발행`
  - `위수탁`
- taxType `type: String` `length: 2` `description: 과세형태`
  - `과세`
  - `영세`
  - `면세`
- chargeDirection `type: String` `length: 3` `description: 과금방향`
  - `정과금`: 공급자 과금
  - `역과금`: 공급받는자 과금
- serialNum `type: String` `length: 30` `description: 일련번호`
- kwon `type: Integer` `length: 4` `description: 책번호 "권" 항목`
- ho `type: Integer` `length: 4` `description: 책번호 "호" 항목`
- writeDate `type: String` `length: 8` `description: 작성일자`
  - 형식 : yyyyMMdd
- purposeType `type: String` `length: 2` `description: 영수/청구`
  - `영수`
  - `청구`
  - `없음`
- supplyCostTotal `type: String` `length: 18` `description: 공급가액 합계`
- taxTotal `type: String` `length: 18` `description: 세액 합계`
- totalAmount `type: String` `length: 18` `description: 합계금액`
- cash `type: String` `length: 18` `description: 현금`
- chkBill `type: String` `length: 18` `description: 수표`
- credit `type: String` `length: 18` `description: 외상`
- note `type: String` `length: 18` `description: 어음`
- remark1 `type: String` `length: 150` `description: 비고1`
  - {invoiceeType}="외국인" 경우 외국인등록번호 또는 여권번호 반환
- remark2 `type: String` `length: 150` `description: 비고2`
- remark3 `type: String` `length: 150` `description: 비고3`
- invoicerMgtKey `type: String` `length: 24` `description: 공급자 문서번호`
  - 문서 관리를 위해 파트너가 할당하는 고유 식별번호
- invoicerCorpNum `type: String` `length: 10` `description: 공급자 사업자번호 ('-' 제외)`
- invoicerTaxRegID `type: String` `length: 4` `description: 공급자 종사업장 식별번호`
  - 종사업장 식별번호는 4자리 숫자로만 구성
- invoicerCorpName `type: String` `length: 200` `description: 공급자 상호`
- invoicerCEOName `type: String` `length: 100` `description: 공급자 대표자 성명`
- invoicerAddr `type: String` `length: 300` `description: 공급자 주소`
- invoicerBizType `type: String` `length: 100` `description: 공급자 업태`
- invoicerBizClass `type: String` `length: 100` `description: 공급자 종목`
- invoicerContactName `type: String` `length: 100` `description: 공급자 담당자 성명`
- invoicerDeptName `type: String` `length: 100` `description: 공급자 담당자 부서명`
- invoicerTEL `type: String` `length: 20` `description: 공급자 담당자 연락처`
- invoicerHP `type: String` `length: 20` `description: 공급자 담당자 휴대폰`
- invoicerEmail `type: String` `length: 100` `description: 공급자 담당자 메일`
- invoicerSMSSendYN `type: Boolean` `length: -` `description: 공급자 알림문자 전송 여부`
  - `True`: 전송
  - `False`: 미전송
  - 수신자 : 공급받는자 휴대폰번호 {invoiceeHP1}
- invoiceeMgtKey `type: String` `length: 24` `description: 공급받는자 문서번호`
  - 문서 관리를 위해 파트너가 할당하는 고유 식별번호
- invoiceeType `type: String` `length: 3` `description: 공급받는자 유형`
  - `사업자`
  - `개인`
  - `외국인`
- invoiceeCorpNum `type: String` `length: 13` `description: 공급받는자 등록번호 ('-' 제외)`
  - {invoiceeType}="사업자" 경우 사업자번호
  - {invoiceeType}="개인" 경우 주민등록번호
  - {invoiceeType}="외국인" 경우 "9999999999999"
- invoiceeTaxRegID `type: String` `length: 4` `description: 공급받는자 종사업장 식별번호`
  - 종사업장 식별번호는 4자리 숫자로만 구성
- invoiceeCorpName `type: String` `length: 200` `description: 공급받는자 상호`
- invoiceeCEOName `type: String` `length: 100` `description: 공급받는자 대표자 성명`
- invoiceeAddr `type: String` `length: 300` `description: 공급받는자 주소`
- invoiceeBizType `type: String` `length: 100` `description: 공급받는자 업태`
- invoiceeBizClass `type: String` `length: 100` `description: 공급받는자 종목`
- closeDownState `type: Integer` `length: 1` `description: 공급받는자 휴폐업상태`
  - `null`: 미확인
  - `0`: 미등록
  - `1`: 사업중
  - `2`: 폐업
  - `3`: 휴업
  - `4`: 확인실패
  - 세금계산서 발행시 거래처 사업자등록 상태를 조회하여 결과값 반환
- closeDownStateDate `type: String` `length: 8` `description: 공급받는자 휴폐업일자`
  - 형식 : yyyyMMdd
  - {closeDownState}=2 or 3 경우 반환
- invoiceeContactName1 `type: String` `length: 100` `description: 공급받는자 담당자 성명`
- invoiceeDeptName1 `type: String` `length: 100` `description: 공급받는자 담당자 부서명`
- invoiceeTEL1 `type: String` `length: 20` `description: 공급받는자 담당자 연락처`
- invoiceeHP1 `type: String` `length: 20` `description: 공급받는자 담당자 휴대폰`
- invoiceeEmail1 `type: String` `length: 100` `description: 공급받는자 담당자 메일`
- invoiceeSMSSendYN `type: Boolean` `length: -` `description: 공급받는자 알림문자 전송 여부`
  - `True`: 전송
  - `False`: 미전송
  - 수신자 : 공급자 휴대폰번호 {invoicerHP}
- trusteeMgtKey `type: String` `length: 24` `description: 수탁자 문서번호`
  - 수탁자의 문서 관리를 위해 파트너가 할당하는 식별번호
- trusteeCorpNum `type: String` `length: 10` `description: 수탁자 사업자번호 ('-' 제외)`
- trusteeTaxRegID `type: String` `length: 4` `description: 수탁자 종사업장 식별번호`
  - 종사업장 식별번호는 4자리 숫자로만 구성
- trusteeCorpName `type: String` `length: 200` `description: 수탁자 상호`
- trusteeCEOName `type: String` `length: 100` `description: 수탁자 대표자 성명`
- trusteeAddr `type: String` `length: 300` `description: 수탁자 주소`
- trusteeBizType `type: String` `length: 100` `description: 수탁자 업태`
- trusteeBizClass `type: String` `length: 100` `description: 수탁자 종목`
- trusteeContactName `type: String` `length: 100` `description: 수탁자 담당자 성명`
- trusteeDeptName `type: String` `length: 100` `description: 수탁자 담당자 부서명`
- trusteeTEL `type: String` `length: 20` `description: 수탁자 담당자 연락처`
- trusteeHP `type: String` `length: 20` `description: 수탁자 담당자 휴대폰`
- trusteeEmail `type: String` `length: 100` `description: 수탁자 담당자 메일`
- trusteeSMSSendYN `type: Boolean` `length: -` `description: 수탁자 알림문자 전송 여부`
  - `True`: 전송
  - `False`: 미전송
  - 수신자 : 공급받는자 휴대폰번호 {invoiceeHP1}
- modifyCode `type: String` `length: 1` `description: 수정 사유코드`
  - 수정세금계산서 작성시 반환 [\[참고\] 수정세금계산서](https://developers.popbill.com/guide/taxinvoice/introduction/modified-taxinvoice)
- orgNTSConfirmNum `type: String` `length: 24` `description: 당초 국세청승인번호`
  - 수정세금계산서 작성시 반환
- businessLicenseYN `type: Boolean` `length: -` `description: 팝빌에 등록된 사업자등록증 첨부 여부`
  - `True`: 첨부
  - `False`: 미첨부
- bankBookYN `type: Boolean` `length: -` `description: 팝빌에 등록된 통장사본 첨부 여부`
  - `True`: 첨부
  - `False`: 미첨부
- detailList `type: Collection of PBTIDetail` `length: -` `description: 품목 상세정보`
  - 최대 : 99개
  - serialNum `type: Integer` `length: 2` `description: 일련번호`
    - 1부터 순차적으로 입력
    - 최대 : 99
  - purchaseDT `type: String` `length: 8` `description: 거래일자`
    - 형식 : yyyyMMdd
  - itemName `type: String` `length: 100` `description: 품명`
  - spec `type: String` `length: 60` `description: 규격`
  - qty `type: String` `length: 12` `description: 수량`
    - -99999999.99 \~ 999999999.99 소수점 아래 2번째 자리까지 입력 가능
  - unitCost `type: String` `length: 18` `description: 단가`
    - -99999999999999.99 \~ 999999999999999.99 소수점 아래 2번째 자리까지 입력 가능
  - supplyCost `type: String` `length: 18` `description: 공급가액`
    - 정수만 입력 가능
    - 마이너스 금액 입력 가능, 소수점 자동 절사
  - tax `type: String` `length: 18` `description: 세액`
    - 정수만 입력 가능
    - 마이너스 금액 입력 가능, 소수점 자동 절사
  - remark `type: String` `length: 100` `description: 비고`
- addContactList `type: Collection of PBTIContact` `length: -` `description: 공급받는자 추가담당자 정보`
  - 최대 : 5명
  - serialNum `type: Integer` `length: 1` `description: 일련번호`
    - 1부터 순차적으로 입력
    - 최대 : 5
  - contactName `type: String` `length: 100` `description: 담당자 성명`
  - email `type: String` `length: 100` `description: 메일`

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 4. CheckMgtKeyInUse - 문서번호 사용 여부 확인

파트너가 세금계산서 관리 목적으로 할당하는 문서번호의 사용여부를 확인합니다.

- 이미 사용 중인 문서번호는 중복 사용이 불가하고, 세금계산서가 삭제된 경우에만 문서번호의 재사용이 가능합니다.

```vb
Function checkMgtKeyInUse(CorpNum As String, KeyType As MgtKeyType, MgtKey As String) As PBResponse
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- KeyType `type: MgtKeyType` `length: -` `required: Y` `description: 문서번호 유형 (택 1)`
  - `SELL`: 매출
  - `BUY`: 매입
  - `TRUSTEE`: 위수탁
- MgtKey `type: String` `length: 24` `required: Y` `description: 확인할 문서번호`

### 응답

**PBResponse**

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

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 5. GetXML - 상세정보 확인 (XML)

세금계산서 1건의 상세정보를 XML로 반환합니다.

```vb
Function GetXML(CorpNum As String, KeyType As MgtKeyType, MgtKey As String, Optional UserID As String = "") As PBTaxinvoiceXML
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- KeyType `type: MgtKeyType` `length: -` `required: Y` `description: 문서번호 유형 (택 1)`
  - `SELL`: 매출
  - `BUY`: 매입
  - `TRUSTEE`: 위수탁
- MgtKey `type: String` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**PBTaxinvoiceXML**

- code `type: Long` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: String` `length: -` `description: API 처리에 대한 응답메시지`
- retObject `type: String` `length: -` `description: 전자세금계산서 XML 문서`

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 6. Search - 목록 조회

검색조건에 해당하는 세금계산서를 조회합니다. (최대 조회기간 : 6개월)

```vb
Function Search(CorpNum As String, KeyType As MgtKeyType, DType As String, SDate As String, EDate As String, state As Collection, TType As Collection, taxType As Collection, LateOnly As String, Page As Integer, PerPage As Integer, Order As String, Optional TaxRegIDType As String, Optional TaxRegID As String, Optional TaxRegIDYN As String, Optional QString As String, Optional UserID As String = "", Optional interOPYN As String = "", Optional issueType As Collection = Null, Optional regType As Collection = Null, Optional closeDownState As Collection = Null, Optional mgtKey As String = "")
```

> 매개변수 Page, PerPage, Order를 이용하여 페이징 기능을 구현할 수 있습니다.

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- KeyType `type: MgtKeyType` `length: -` `required: Y` `description: 문서번호 유형 (택 1)`
  - `SELL`: 매출
  - `BUY`: 매입
  - `TRUSTEE`: 위수탁
- DType `type: String` `length: 1` `required: Y` `description: 검색일자 유형 (택 1)`
  - `R`: 등록일자
  - `W`: 작성일자
  - `I`: 발행일자
- SDate `type: String` `length: 8` `required: Y` `description: 검색 시작일자`
  - 형식 : yyyyMMdd
- EDate `type: String` `length: 8` `required: Y` `description: 검색 종료일자`
  - 형식 : yyyyMMdd
- state `type: Collection` `length: -` `required: N` `description: 세금계산서 상태코드`
  - 2, 3번째 자리에 와일드카드(\*) 사용가능. 예) "3\*\*", "60\*" [\[참고\] 팝빌 상태코드](https://developers.popbill.com/reference/taxinvoice/vba/response-code#state-code)
  - 기본값 : 전체조회
- TType `type: Collection` `length: -` `required: N` `description: 세금계산서 문서 유형 (다중 선택 가능)`
  - `N`: 세금계산서
  - `M`: 수정세금계산서
  - 기본값 : 전체조회
- taxType `type: Collection` `length: -` `required: N` `description: 과세형태 (다중 선택 가능)`
  - `T`: 과세
  - `N`: 면세
  - `Z`: 영세
  - 기본값 : 전체조회
- LateOnly `type: String` `length: -` `required: N` `description: 지연발행 여부`
  - `1`: 지연발행
  - `0`: 정상발행
  - 기본값 : 전체조회
- Page `type: Integer` `length: -` `required: N` `description: 목록 페이지번호`
  - 기본값 : 1
- PerPage `type: Integer` `length: -` `required: N` `description: 페이지당 표시할 목록 건수`
  - 최대 : 1,000건
  - 기본값 : 500건
- Order `type: String` `length: 1` `required: Y` `description: 조회 기준일자 유형을 기준으로 하는 목록 정렬 방향`
  - `D`: 내림차순 : 기본값
  - `A`: 오름차순
- TaxRegIDType `type: String` `length: 1` `required: N` `description: 종사업장번호의 주체 (택 1)`
  - `S`: 공급자
  - `B`: 공급받는자
  - `T`: 수탁자
  - 기본값 : 전체조회
- TaxRegID `type: String` `length: -` `required: N` `description: 종사업장번호`
  - 다수건 검색시 콤마(',')로 구분. 예) 1234,1000
  - 기본값 : 전체조회
- TaxRegIDYN `type: String` `length: 1` `required: N` `description: 종사업장번호 유무`
  - `0`: 없음
  - `1`: 있음
  - 기본값 : 전체조회
- QString `type: String` `length: -` `required: N` `description: 조회 검색어 ('-' 제외)`
  - 상호명 조회시 거래처상호 입력
  - 사업자 조회시 사업자번호 입력
  - 개인 조회시 주민등록번호 입력
  - 외국인 조회시 "9999999999999" 입력
  - 기본값 : 전체조회
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`
- interOPYN `type: String` `length: 1` `required: N` `description: 세금계산서 작성유형`
  - `0`: 팝빌 사이트를 통해 작성한 세금계산서
  - `1`: API로 작성한 세금계산서
  - 기본값 : 전체조회
- issueType `type: Collection` `length: -` `required: N` `description: 발행형태 (다중 선택 가능)`
  - `N`: 정발행
  - `R`: 역발행
  - `T`: 위수탁
  - 기본값 : 전체조회
- regType `type: Collection` `length: -` `required: N` `description: 전자세금계산서 등록 유형 (다중 선택 가능)`
  - `P`: 팝빌에서 등록(발행)
  - `H`: 홈택스 또는 ASP에서 등록(발행)
  - 기본값 : 전체조회
- closeDownState `type: Collection` `length: -` `required: N` `description: 휴폐업상태 (다중 선택 가능)`
  - `N`: 미확인
  - `0`: 미등록
  - `1`: 사업중
  - `2`: 폐업
  - `3`: 휴업
  - `4`: 확인실패
  - 기본값 : 전체조회
- mgtKey `type: String` `length: -` `required: N` `description: 문서번호`
  - 세금계산서의 문서번호 또는 국세청승인번호 중 검색하고자 하는 정보 입력
  - 기본값 : 전체조회

### 응답

**PBTISearchList**

- code `type: Integer` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: String` `length: -` `description: API 처리에 대한 응답메시지`
- total `type: Integer` `length: -` `description: 총 검색결과 건수`
- perPage `type: Integer` `length: -` `description: 페이지당 목록 건수`
- pageNum `type: Integer` `length: -` `description: 페이지 번호`
- pageCount `type: Integer` `length: -` `description: 페이지 개수`
- list `type: PBTIInfo[ ]` `length: -` `description: 세금계산서 상태/요약정보`
  - 함수 [\[GetInfo – 상태 확인\]](https://developers.popbill.com/reference/taxinvoice/vba/api/info#GetInfo)의 리턴값 구성과 동일
  - 최대 : 1,000건
  - itemKey `type: String` `length: 18` `description: 팝빌에서 할당한 식별번호`
  - taxType `type: String` `length: 2` `description: 과세형태`
    - `과세`
    - `영세`
    - `면세`
  - writeDate `type: String` `length: 8` `description: 작성일자`
    - 형식 : yyyyMMdd
  - regDT `type: String` `length: 14` `description: 임시저장 일시`
    - 형식 : yyyyMMddHHmmss
  - issueType `type: String` `length: 3` `description: 발행형태`
    - `정발행`
    - `역발행`
    - `위수탁`
  - supplyCostTotal `type: String` `length: 18` `description: 공급가액 합계`
  - taxTotal `type: String` `length: 18` `description: 세액 합계`
  - purposeType `type: String` `length: 2` `description: 영수/청구`
    - `영수`
    - `청구`
    - `없음`
  - issueDT `type: String` `length: 14` `description: 발행일시`
    - 형식 : yyyyMMddHHmmss
  - lateIssueYN `type: Boolean` `length: -` `description: 지연발행 여부`
    - `True`: 지연발행
    - `False`: 정상발행
  - preIssueDT `type: String` `length: 14` `description: 발행예정일시`
    - 형식 : yyyyMMddHHmmss
  - openYN `type: Boolean` `length: -` `description: 개봉 여부`
    - `True`: 개봉
    - `False`: 미개봉
    - {issueType}="정발행" or "위수탁" 경우 공급받는자가 세금계산서 보기 버튼을 클릭한 경우 개봉 처리
    - {issueType}="역발행" 경우 공급자가 세금계산서 보기 버튼을 클릭한 경우 개봉 처리
  - openDT `type: String` `length: 14` `description: 개봉일시`
    - 형식 : yyyyMMddHHmmss
  - stateMemo `type: String` `length: 200` `description: 상태메모`
  - stateCode `type: Integer` `length: 3` `description: 상태코드`
    - [\[참고\] 팝빌 상태코드](https://developers.popbill.com/reference/taxinvoice/vba/response-code#state-code)
  - stateDT `type: String` `length: 14` `description: 상태 변경일시`
    - 형식 : yyyyMMddHHmmss
  - ntsconfirmNum `type: String` `length: 24` `description: 국세청승인번호`
    - 전자세금계산서 발행 시점에 팝빌에서 자동으로 할당
  - ntsresult `type: String` `length: 6` `description: 국세청 전송결과`
  - ntssendDT `type: String` `length: 14` `description: 국세청 전송일시`
    - 형식 : yyyyMMddHHmmss
  - ntsresultDT `type: String` `length: 14` `description: 국세청 결과 수신일시`
    - 형식 : yyyyMMddHHmmss
  - ntssendErrCode `type: String` `length: 8` `description: 국세청 결과코드`
    - [\[참고\] 국세청 결과코드](https://developers.popbill.com/reference/taxinvoice/vba/response-code#nts-result)
  - modifyCode `type: Integer` `length: 1` `description: 수정세금계산서 발행시 입력한 사유코드`
    - [\[참고\] 수정세금계산서](https://developers.popbill.com/guide/taxinvoice/introduction/modified-taxinvoice)
  - interOPYN `type: Boolean` `length: -` `description: 연동문서 여부`
    - `True`: API를 통해 발행한 연동문서
    - `False`: 팝빌 사이트를 통해 발행한 문서
  - invoicerCorpName `type: String` `length: 200` `description: 공급자 상호`
  - invoicerCorpNum `type: String` `length: 10` `description: 공급자 사업자번호`
  - invoicerMgtKey `type: String` `length: 24` `description: 파트너가 팝빌에 세금계산서를 임시저장 또는 발행시 할당한 문서번호`
  - invoicerPrintYN `type: Boolean` `length: -` `description: 공급자 인쇄여부`
    - `True`: 인쇄
    - `False`: 미인쇄
  - invoiceeCorpName `type: String` `length: 200` `description: 공급받는자 상호`
  - invoiceeCorpNum `type: String` `length: 13` `description: 공급받는자 사업자번호`
  - invoiceeMgtKey `type: String` `length: 24` `description: 파트너가 할당한 문서번호`
  - invoiceePrintYN `type: Boolean` `length: -` `description: 공급받는자 인쇄여부`
    - `True`: 인쇄
    - `False`: 미인쇄
  - closeDownState `type: Integer` `length: 1` `description: 공급받는자 휴폐업상태`
    - `null`: 미확인
    - `0`: 미등록
    - `1`: 사업중
    - `2`: 폐업
    - `3`: 휴업
    - `4`: 확인실패
  - closeDownStateDate `type: String` `length: 8` `description: 공급받는자 휴폐업일자`
    - 형식 : yyyyMMdd
  - trusteeCorpName `type: String` `length: 200` `description: 수탁자 상호`
  - trusteeCorpNum `type: String` `length: 10` `description: 수탁자 사업자번호`
  - trusteeMgtKey `type: String` `length: 24` `description: 파트너가 할당한 문서번호`
  - trusteePrintYN `type: Boolean` `length: -` `description: 수탁자 인쇄여부`
    - `True`: 인쇄
    - `False`: 미인쇄

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 7. GetLogs - 상태 변경이력 확인

세금계산서의 상태에 대한 변경이력을 확인합니다.

```vb
Function GetLogs(CorpNum As String, KeyType As MgtKeyType, MgtKey As String, Optional UserID As String = "") As Collection
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- KeyType `type: MgtKeyType` `length: -` `required: Y` `description: 문서번호 유형 (택 1)`
  - `SELL`: 매출
  - `BUY`: 매입
  - `TRUSTEE`: 위수탁
- MgtKey `type: String` `length: 24` `required: Y` `description: 파트너가 할당한 문서번호`
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**PBTILog**

- docLogType `type: Integer` `length: 3` `description: 로그타입`
  - `100`: 임시저장
  - `101`: 수정
  - `102`: 개봉
  - `103`: 수신확인
  - `111`: 메일 재전송
  - `112`: 문자 재전송
  - `113`: 팩스 재전송
  - `122`: 문자 전송결과
  - `123`: 팩스 전송결과
  - `124`: 사업자등록상태 확인
  - `125`: 문서번호 할당
  - `220`: 역발행요청
  - `221`: 역발행요청 거부
  - `222`: 역발행요청 취소
  - `230`: 발행
  - `240`: 발행취소
  - `250`: 국세청전송 요청
  - `251`: 국세청전송 대기중
  - `252`: 국세청전송 진행중
  - `253`: 국세청전송 접수
  - `254`: 국세청전송 성공
  - `255`: 국세청전송 실패
- log `type: String` `length: 2000` `description: 이력정보`
- procType `type: String` `length: 3` `description: 처리형태`
  - `연동`: API를 통해 처리함
  - `일반`: 팝빌 사이트를 통해 처리함
  - `시스템`: 팝빌이 처리함
- procCorpName `type: String` `length: 70` `description: 처리회사명`
- procContactName `type: String` `length: 30` `description: 처리담당자`
- procMemo `type: String` `length: 200` `description: 처리메모`
- regDT `type: String` `length: 14` `description: 등록일시`
  - 형식 : yyyyMMddHHmmss
- ip `type: String` `length: 39` `description: 아이피`

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 8. GetURL - 문서함 팝업 URL

![문서함 팝업 URL 미리보기](https://developers.popbill.com/images/reference/taxinvoice/getURL.png)

**전자세금계산서 문서함의 팝업 URL을 반환합니다.**

- 권장 사이즈 : width = 1,280px (최소 1,000px) / height = 800px
- 반환되는 URL은 30초 동안만 사용이 가능합니다.
- 반환되는 URL은 팝빌회원의 로그인 세션을 포함하고 있으니 사용에 유의하여 주시기 바랍니다.

```vb
Function GetURL(CorpNum As String, UserID As String, TOGO As String) As String
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`
- TOGO `type: String` `length: -` `required: Y` `description: 접근 메뉴 (택 1)`
  - `TBOX`: 임시 문서함
  - `SWBOX`: 매출 발행 대기함
  - `SBOX`: 매출 문서함
  - `PWBOX`: 매입 발행 대기함
  - `PBOX`: 매입 문서함
  - `WRITE`: 정발행 작성

### 응답

String - 요청에 대한 응답 URL

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`
