# 현금영수증 발급(외부) API

{% hint style="warning" %}
**Deprecated**

이 문서는 더 이상 관리되지 않습니다.

[PortOne 개발자센터](https://developers.portone.io/)를 이용해주세요.
{% endhint %}

### 포트원과 별개로 거래된 일반 현금결제에 대해서 현금영수증을 발행합니다.

<details>

<summary><strong>지원되는 PG사</strong> 확인하기</summary>

* **KG 이니시스**
* **NHN KCP**
* **Settle Bank**
* **NICE Payments**
* **페이조아(다우)**
* **KICC**

</details>

## 현금영수증 발급 API

<mark style="color:green;">`POST`</mark> `https://api.iamport.kr/receipts/external/{merchant_uid}`

포트원 거래와 무관하게 현금영수증을 발급할수 있습니다. 단 주문번호는 현금거래 주문번호와 동일한 번호를 기재해야 추후 대사가 가능한점 유념하시기 바랍니다.

#### Path Parameters

| Name                                            | Type   | Description                              |
| ----------------------------------------------- | ------ | ---------------------------------------- |
| merchant\_uid<mark style="color:red;">\*</mark> | String | <mark style="color:red;">**주문번호**</mark> |

#### Request Body

| Name                                         | Type    | Description                                                                                                                                                                               |
| -------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name<mark style="color:red;">\*</mark>       | String  | <mark style="color:red;">**현금영수증 발행 주문명**</mark>                                                                                                                                          |
| amount<mark style="color:red;">\*</mark>     | integer | <mark style="color:red;">**현금영수증 발행 금액**</mark>                                                                                                                                           |
| identifier<mark style="color:red;">\*</mark> | String  | <p><mark style="color:red;"><strong>현금영수증 식별정보 구분코드</strong></mark></p><p><code>국세청현금영수증카드</code></p><p><code>휴대폰번호</code></p><p><code>주민등록번호</code></p><p><code>사업자등록번호</code></p>       |
| identifier\_type                             | String  | <p><strong>현금영수증 식별정보 구분코드</strong></p><p><code>person : 주민등록번호</code></p><p><code>business : 사업자등록번호</code></p><p><code>phone : 휴대폰번호</code></p><p><code>taxcard : 국세청현금영수증카드</code></p> |
| type                                         | String  | <p><strong>현금영수증 발행 구분코드</strong></p><p><code>소득공제용(개인) : person</code></p><p><code>지출증빙용(법인) : company</code></p><p><code>기본값 : person</code></p>                                        |
| buyer\_name                                  | String  | \*\*구매자 이름                                                                                                                                                                                |
| buyer\_email                                 | String  | **구매자 Email**                                                                                                                                                                             |
| buyer\_tel                                   | String  | **구매자 전화번호**                                                                                                                                                                              |
| tax\_free                                    | integer | **면세금액**                                                                                                                                                                                  |
| pg                                           | String  | **PG 구분코드**                                                                                                                                                                               |

{% tabs %}
{% tab title="200: OK 성공" %}
{% tabs %}
{% tab title="ExternalReceiptResponse" %}
**`code`** <mark style="color:purple;">**integer**</mark>

**응답코드**

0이면 정상적인 조회, 0 이 아닌 값이면 message를 확인해봐야 합니다

**`message`** <mark style="color:green;">**string**</mark>

**응답메세지**

code 값이 0이 아닐 때, '존재하지 않는 결제정보입니다'와 같은 오류 메세지를 포함합니다

**`response`** <mark style="color:red;">**`(ExternalReceiptAnnotation, optional)`**</mark>
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="ExternalReceiptAnnotation" %}
**`merchant_uid`** <mark style="color:red;">**\***</mark> <mark style="color:green;">**`string`**</mark>

**`주문번호`**

**`receipt_tid`** <mark style="color:green;">**`string`**</mark>

**`현금영수증 PG사 발행고유번호`**

**`apply_num`** <mark style="color:red;">**\***</mark> <mark style="color:green;">**`string`**</mark>

**`현금영수증 국세청 발행번호`**

**`type`** <mark style="color:red;">**\***</mark> <mark style="color:green;">**`string`**</mark>

**`현금영수증 발행대상 타입`**

* 개인 : `person`
* 사업자 : `company`

**`amount`** <mark style="color:red;">**\***</mark> <mark style="color:orange;">**`integer`**</mark>

**`현금영수증 발행금액`**

**`vat`** <mark style="color:red;">**\***</mark> <mark style="color:orange;">**`integer`**</mark>

**`부가세`**

**`receipt_url`** <mark style="color:green;">**`string`**</mark>

**`발행된 현금영수증 URL`**

**`applied_at`** <mark style="color:red;">**\***</mark> <mark style="color:orange;">**`integer`**</mark>

**현금영수증 발행시각** `UNIX TIMESTAMP`

**`cancelled_at`** <mark style="color:orange;">**`integer`**</mark>

**`현금영수증 발행취소시각`** `UNIX TIMESTAMP`
{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="400: Bad Request 필수 파라미터가 누락된 경우, 이미 현금영수증 발행된 merchant\_uid 에 대해 요청한 경우" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized 인증 Token이 전달되지 않았거나 유효하지 않은 경우" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="500: Internal Server Error 현금영수증 발행에 실패한 경우" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### **주요 요청 파라미터 상세 설명**

> **`identifier`** <mark style="color:red;">**\***</mark> <mark style="color:green;">**`string`**</mark>
>
> **`현금영수증 식별정보 구분코드`**
>
> 국세청현금영수증카드, 휴대폰번호, 주민등록번호, 사업자등록번호 를 기재합니다.

> **`identifier_type`** <mark style="color:red;">**\***</mark> <mark style="color:green;">**`string`**</mark>
>
> **`현금영수증 식별정보 구분코드`**
>
> **KICC, 세틀뱅크**인 경우에만 <mark style="color:red;">**필수**</mark>
>
> KG이니시스/NHN KCP/나이스페이먼츠/페이조아는 **identifier 만으로 자동 처리**

> **`pg`** <mark style="color:green;">**string**</mark>
>
> **pg 구분코드**
>
> 관리자콘솔 API 방식 비인증 PG설정이 2개 이상인 경우 필수적으로 기재해야 하는 항목입니다.
>
> 동일 PG사에 <mark style="color:red;">**두개의 MID**</mark> 를 설정한 경우 아래 양식으로 기재 합니다. > **{PG사}.{PG상점아이디}**
>
> * 나이스페이먼츠, JTNet 2가지 PG설정이 되어있다면, pg 파라미터로 **nice** 또는 **jtnet**로 구분 가능
> * 나이스페이먼츠로부터 2개 이상의 상점아이디를 발급받았다면, **nice.MID1** 또는 **nice.MID2**로 구분 가능

<details>

<summary>Response Model Schema</summary>

```json
{
  "code": 0,
  "message": "string",
  "response": {
    "merchant_uid": "string",
    "receipt_tid": "string",
    "apply_num": "string",
    "type": "person",
    "amount": 0,
    "vat": 0,
    "receipt_url": "string",
    "applied_at": 0,
    "cancelled_at": 0
  }
}
```

</details>

{% hint style="success" %}
**Swagger Test Link**

[**https://api.iamport.kr/#!/receipts/issueExternalReceipt**](https://api.iamport.kr/#!/receipts/issueExternalReceipt)
{% endhint %}
