> For the complete documentation index, see [llms.txt](https://movie-team.gitbook.io/movieteam/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://movie-team.gitbook.io/movieteam/kakao/undefined-1.md).

# 카카오페이

## 티켓 결제 요청

<mark style="color:green;">`POST`</mark> `http://127.0.0.1:8000/api/movies/ticket/pay/`

#### Headers

| Name                                            | Type   | Description                    |
| ----------------------------------------------- | ------ | ------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | "Bearer " + 발급 받은 access token |

{% tabs %}
{% tab title="200: OK next\_redirect\_pc\_url로 접속하면 카카오페이 큐알코드가 나옴" %}

````json
```json
{
    "tid": "tid",
    "tms_result": false,
    "next_redirect_app_url": "next_redirect_app_url",
    "next_redirect_mobile_url": "next_redirect_mobile_url",
    "next_redirect_pc_url": "next_redirect_pc_url",
    "android_app_scheme": "android_app_scheme",
    "ios_app_scheme": "ios_app_scheme",
    "created_at": "2023-11-20T17:07:11"
}
```
````

{% endtab %}
{% endtabs %}

## pg\_token 발급

<mark style="color:green;">`POST`</mark> `http://127.0.0.1:8000/api/movies/success/`

{% tabs %}
{% tab title="200: OK " %}

````json
```json
{
    "pg_token": "pg_token"
}
```
````

{% endtab %}
{% endtabs %}

## 결제 승인 요청

<mark style="color:green;">`POST`</mark> `http://127.0.0.1:8000/api/movies/confirm/`

#### Headers

| Name                                            | Type   | Description                    |
| ----------------------------------------------- | ------ | ------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | "Bearer " + 발급 받은 access token |

#### Request Body

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| pg\_token<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="200: OK " %}

````json
```json
{
    "aid": "A55c5c122b4c11f91afa",
    "tid": "T55c5bf666877122224f",
    "cid": "TC0ONETIME",
    "partner_order_id": "1",
    "partner_user_id": "sirl",
    "payment_method_type": "MONEY",
    "item_name": "ticket",
    "quantity": 2,
    "amount": {
        "total": 20000,
        "tax_free": 0,
        "vat": 1818,
        "point": 0,
        "discount": 0,
        "green_deposit": 0
    },
    "created_at": "2023-11-21T16:27:50",
    "approved_at": "2023-11-21T16:30:42"
}
```
````

{% endtab %}
{% endtabs %}

## 결제 취소

<mark style="color:red;">`DELETE`</mark> `http://127.0.0.1:8000/api/movies/cancel/`

#### Headers

| Name                                            | Type   | Description                    |
| ----------------------------------------------- | ------ | ------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | "Bearer " + 발급 받은 access token |

#### Request Body

| Name                                      | Type | Description          |
| ----------------------------------------- | ---- | -------------------- |
| payment<mark style="color:red;">\*</mark> | List | payment\_pk들을 담은 리스트 |

{% tabs %}
{% tab title="200: OK 좌석별로 결제 취소 가능" %}

````json
```json
[
    {
        "aid": "A55c5cfe66877122226f",
        "tid": "T55c5bf666877122224f",
        "cid": "TC0ONETIME",
        "status": "PART_CANCEL_PAYMENT",
        "partner_order_id": "1",
        "partner_user_id": "sirl",
        "payment_method_type": "MONEY",
        "item_name": "ticket",
        "quantity": 2,
        "amount": {
            "total": 20000,
            "tax_free": 0,
            "vat": 1818,
            "point": 0,
            "discount": 0,
            "green_deposit": 0
        },
        "approved_cancel_amount": {
            "total": 10000,
            "tax_free": 0,
            "vat": 909,
            "point": 0,
            "discount": 0,
            "green_deposit": 0
        },
        "canceled_amount": {
            "total": 10000,
            "tax_free": 0,
            "vat": 909,
            "point": 0,
            "discount": 0,
            "green_deposit": 0
        },
        "cancel_available_amount": {
            "total": 10000,
            "tax_free": 0,
            "vat": 909,
            "point": 0,
            "discount": 0,
            "green_deposit": 0
        },
        "created_at": "2023-11-21T16:27:50",
        "approved_at": "2023-11-21T16:30:42",
        "canceled_at": "2023-11-21T16:32:14"
    }
]
```
````

{% endtab %}
{% endtabs %}
