# 외부 발급분 취소 API

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

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

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

### 포트원 별개거래로 발생된 현금영수증 거래를 취소합니다.

<details>

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

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

</details>

## 포트원에서 발급하지 않은 PG발급 거래를 취소합니다.

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

포트원과 별개로 거래된 일반 현금결제에 대해 포트원 내에 설정된 PG사로 포트원 API를 이용해 현금영수증을 발행취소하는 API입니다.

**merchant\_uid**

는 현금결제를 구분할 고유주문번호를 의미하며 발행에 사용된 값을 전달하면 됩니다.

#### Path Parameters

| Name                                            | Type   | Description                                                                    |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------ |
| merchant\_uid<mark style="color:red;">\*</mark> | String | <p><mark style="color:red;"><strong>주문번호</strong></mark></p><p>발급취소대상 주문번호</p> |

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

**응답코드**

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

**`message`** <mark style="color:red;">**\***</mark> <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="404: Not Found 현금영수증 발행된 적이 없는 merchant\_uid 에 대해 요청한 경우" %}

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

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

<details>

<summary>Response Model Schema</summary>

```
{
  "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/revokeExternalReceipt**](https://api.iamport.kr/#!/receipts/revokeExternalReceipt)
{% endhint %}
