> For the complete documentation index, see [llms.txt](https://onestore-dev.gitbook.io/dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onestore-dev.gitbook.io/dev/tools/billing/old-version/v17/api.md).

# 원스토어 인앱결제 서버 API

원스토어 인앱결제 서버 API란 원스토어에서 결제된 인앱 상품의 데이터를 개발사에 제공하기 위한 Open API를 말합니다.\
해당 API를 사용하기 위해서는 OAuth 인증이 필요합니다.

### **HOST URL**  <a href="#id-api-hosturl" id="id-api-hosturl"></a>

본 문서에서 사용되는 {host}의 URL은 아래와 같습니다.

| 원스토어 환경 | Host URL            |
| ------- | ------------------- |
| 검증(개발)  | sbpp.onestore.co.kr |
| 상용      | apis.onestore.co.kr |

### **원스토어 OAuth v2** <a href="#id-api-oauthv2" id="id-api-oauthv2"></a>

* #### **OAuth v2 개요** <a href="#id-api-oauthv2" id="id-api-oauthv2"></a>
  * 원스토어 서버 Open API를 연동하기 위해서는 OAuth 인증이 필요합니다.
    * 원스토어 OAuth v2의 이해
    * AccessToken은 원스토어의 Server Open API를 통하여 발급받을 수 있는 값으로 원스토어에서 제공하는 Server Open API 호출시 인증값으로 사용됩니다.
    * AccessToken은 기본적으로 3600초의 유효기간이 있으며, 유효기간이 만료 되거나 600초 미만으로 남은 경우에 getAccessToken()을 호출하면 새로운 AccessToken이 발급됩니다.
    * 기존의 AccessToken도 유효기간이 끝날 때까지는 사용이 가능합니다.
    * 다수의 AccessToken이 발행되는 방식이므로 개발사의 서비스 인스턴스 별로 서로 다른 AccessToken을 취득하고 사용할 수 있는 형태가 됩니다.
* * * 일반적인 연동 흐름은 다음과 같습니다.

      ![](https://dev.onestore.co.kr/wiki/ko/doc/files/1572957/7340197/1/1593140116000/oauth_v2_process.png)

      AccessToken을 얻는 과정(1번)은 API 호출 시 인증 오류가 발생했을 때 호출하면 됩니다.
* * * 원스토어의 Server OpenAPI 의 호출을 위해서는 Authorization Bearer 스킴을 사용하며 호출 샘플은 아래와 같습니다.

      | `GET /api/purchase/details/SANDBOX3000120004476/com.onestore.game.goindol HTTP/1.1Host: sbpp.onestore.co.krAuthorization: Bearer 680b3621-1234-1234-1234-8adfaef561b4` |
      | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

      Authorization 헤더에는 위 예제와 같이 Bearer + 공백 + AccessToken이 대소문자 구분하여 정확히 입력되어야 합니다.\
      Bearer의 값은 getAccessToken()을 호출하여 발급받은 AccessToken 값입니다.
* * * 잘못된 예

      | `Authorization: 680b3621-1234-1234-1234-8adfaef561b4Authorization: bearer 680b3621-1234-1234-1234-8adfaef561b4Authorization: Bearer <680b3621-1234-1234-1234-8adfaef561b4>Authorization:Bearer680b3621-1234-1234-1234-8adfaef561b4` |
      | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

### **OAuth API 상세** <a href="#id-api-oauthapi" id="id-api-oauthapi"></a>

* #### **AccessToken 발급** <a href="#id-api-accesstoken" id="id-api-accesstoken"></a>
  * #### **URI**: https\://{host}/v2/oauth/token <a href="#id-api-uri-https-host-v2-oauth-token" id="id-api-uri-https-host-v2-oauth-token"></a>
  * #### **Method**: POST, PUT <a href="#id-api-method-post-put" id="id-api-method-post-put"></a>
  * **Request Header**

    | Parameter Name | Description                                                             | Example                                         |
    | -------------- | ----------------------------------------------------------------------- | ----------------------------------------------- |
    | Content-Type   | Http 요청시 Content Type으로 반드시 application/x-www-form-urlencoded 로 설정되어야 함 | Content-Type: application/x-www-form-urlencoded |

    \
    **parameter**

    | Parameter Name | Description                        | Example                                      |
    | -------------- | ---------------------------------- | -------------------------------------------- |
    | client\_id     | 일반적으로 packageName과 동일              | com.onestore.game.goindol                    |
    | client\_secret | 개발자센터에서 앱 등록 시 발급된 client secret 값 | vxIMAGcVz3DAx20uDBr/IDWNJAPNHFl7YruF4uxB6BI= |
    | grant\_type    | 고정값                                | client\_credentials                          |
  * **Response Body : JSON 형식**

    | Element Name  | Data Type | Data Size | Description                |
    | ------------- | --------- | --------- | -------------------------- |
    | status        | String    | 7         | Access Token 발급결과          |
    | client\_id    | String    | 255       | OAuth 인증 client\_id        |
    | access\_token | String    | 36        | <p><br></p>                |
    | token\_type   | String    | 6         | bearer 방식만 제공              |
    | expires\_in   | Integer   | 10        | token 만료기한, 단위 : 초(second) |
    | scope         | String    | 1024      | token 사용 범위                |

    Request Example

    | 12345 | `POST /v2/oauth/token HTTP/1.1Host: apis.onestore.comContent-Type: application/x-www-form-urlencoded;charset=UTF-8` `grant_type=client_credentials&client_id=com.onestore.game.goindol&client_secret=vxIMAGcVz3DAx20uDBr/IDWNJAPNHFl7YruF4uxB6BI=` |
    | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

    Response Example

    | 12345678 | `{  "status":"SUCCESS",  "client_id":"com.onestore.game.goindol",  "access_token":"680b3621-1234-1234-1234-8adfaef561b4",  "token_type":"bearer",  "expires_in":3010,  "scope":"DEFAULT"}` |
    | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
* #### **AccessToken 발급 예시** <a href="#id-api-accesstoken" id="id-api-accesstoken"></a>
  * curl을 사용해서 발급하는 샘플입니다.

    | 123456789101112131415161718 | `curl -v -X POST -H "Content-Type: application/x-www-form-urlencoded"` `https://sbpp.onestore.co.kr/v2/oauth/token -d "grant_type=client_credentials" -d "client_id=com.onestore.game.goindol" -d "client_secret=vxIMAGcVz3DAx20uDBr/IDWNJAPNHFl7YruF4uxB6BI="> POST /v2/oauth/token HTTP/1.1> Host: sbpp.onestore.co.kr> User-Agent: curl/7.43.0> Accept: */*> Content-Type: application/x-www-form-urlencoded;charset=UTF-8> Content-Length: 35>* upload completely sent off: 35` `out of 35` `bytes< HTTP/1.1` `200` `200< Date: Wed, 02` `May 2018` `02:52:42` `GMT< Server: Apache< Connection: close< Transfer-Encoding: chunked< Content-Type: application/json;charset=UTF-8<* Closing connection 0{"status":"SUCCESS","client_id":"com.onestore.game.goindol","access_token":"680b3621-1234-1234-1234-8adfaef561b4","token_type":"bearer","expires_in":3600,"scope":"DEFAULT"}` |
    | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

    검증(개발) 환경인 Sandbox와 상용환경의 AccessToken은 독립적으로 관리되므로, 환경 별로 AccessToken을 분리하여 관리하셔야 합니다.

### **서버 API 상세** <a href="#id-api-api" id="id-api-api"></a>

* #### **getPurchaseDetails (구매상품 상세조회)** <a href="#id-api-getpurchasedetails" id="id-api-getpurchasedetails"></a>
  * **Desc**: 구매한 상품의 상세정보를 조회합니다.
  * **URI**: https\://{host}/v2/purchase/details/{purchaseId}/{packageName}
  * **Method**: GET
  * **Parameters**:\
    &#x20;String packageName : API를 호출하는 앱의 패키지 네임 (Data Size : 128)\
    &#x20;String purchaseId : 구매 ID (Data Size : 20)
  * **Request Header**

    | Parameter Name | Data Type | Required | Description                             |
    | -------------- | --------- | -------- | --------------------------------------- |
    | Authorization  | String    | true     | Access Token API를 통해 발급받은 access\_token |
    | Content-Type   | String    | true     | application/json                        |

    Example

    | 1234 | `Request.setHeader("Authorization", " Bearer <Access-Token>");Request.setHeader("Content-Type", "application/json");` `<!--실제 요청 시 Bearer 다음의 <, >는 제외하고 access token 값만 입력해주세요-->` |
    | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

    \
    **Request Body**: 없음

    **Response Body**:

    | Element Name     | Data Type | Data Size | Required | Description                    |
    | ---------------- | --------- | --------- | -------- | ------------------------------ |
    | consumptionState | Integer   | 1         | true     | 구매한 상품의 소비상태 (0 : 미소비, 1 : 소비) |
    | developerPayload | String    | 200       | true     | 개발사가 제공한 결제 고유 식별자             |
    | purchaseState    | Integer   | 1         | true     | 구매상태 (0 : 구매완료, 1 : 취소완료)      |
    | purchaseTime     | Integer   | 13        | true     | 구매시간(ms)                       |

    Example

    | 123456 | `{  "consumptionState": 0,  "developerPayload": "developerPayload",  "purchaseState": 0,  "purchaseTime": 1345678900000}` |
    | ------ | ------------------------------------------------------------------------------------------------------------------------- |

### **getPurchaseDetailsByProductId (구매상품 상세조회)** <a href="#id-api-getpurchasedetailsbyproductid" id="id-api-getpurchasedetailsbyproductid"></a>

* **Desc**: 구매한 상품의 상세정보를 조회합니다. 해당 인앱 상품(productId)의 구매가 맞는지 체크 후 응답하므로 더욱 보안성이 높습니다.
* **URI**: https\://{host}/v2/purchase/details-by-productid/{purchaseId}/{packageName}/{productId}
* **Method**: GET
* **Parameters**:\
  &#x20;String packageName : API를 호출하는 앱의 패키지 네임 (Data Size : 128)\
  &#x20;String purchaseId : 구매 ID (Data Size : 20)\
  &#x20;String productId : 상품 ID (Data Size : 150)
* **Request Header**

  | Parameter Name | Data Type | Required | Description                             |
  | -------------- | --------- | -------- | --------------------------------------- |
  | Authorization  | String    | true     | Access Token API를 통해 발급받은 access\_token |
  | Content-Type   | String    | true     | application/json                        |

  Example

  | 123 | `Request.setHeader("Authorization", " Bearer <Access-Token>");Request.setHeader("Content-Type", "application/json");<!--실제 요청 시 Bearer 다음의 <, >는 제외하고 access token 값만 입력해주세요-->` |
  | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

  \
  **Request Body**: 없음\
  **Response Body**:

  | Element Name     | Data Type | Data Size | Required | Description                    |
  | ---------------- | --------- | --------- | -------- | ------------------------------ |
  | consumptionState | Integer   | 1         | true     | 구매한 상품의 소비상태 (0 : 미소비, 1 : 소비) |
  | developerPayload | String    | 200       | true     | 개발사가 제공한 결제 고유 식별자             |
  | purchaseState    | Integer   | 1         | true     | 구매상태 (0 : 구매완료, 1 : 취소완료)      |
  | purchaseTime     | Integer   | 13        | true     | 구매시간(ms)                       |

  Example

  | 123456 | `{  "consumptionState": 0,  "developerPayload": "developerPayload",  "purchaseState": 0,  "purchaseTime": 1345678900000}` |
  | ------ | ------------------------------------------------------------------------------------------------------------------------- |

### **getRecurringPurchaseDetails (월정액 상품 구매 상세조회)** <a href="#id-api-getrecurringpurchasedetails" id="id-api-getrecurringpurchasedetails"></a>

* **Desc**: 구매 ID 기준, 월정액 상품의 상세정보를 조회합니다.
* **URI**: https\://{host}/v2/purchase/recurring-details/{purchaseId}/{packageName}
* **Method**: GET
* **Parameters**:\
  &#x20;String packageName : API를 호출하는 앱의 패키지 네임 (Data Size : 128)\
  &#x20;String purchaseId : 구매 ID (Data Size : 20)
* **Request Header**

  | Parameter Name | Data Type | Required | Description                             |
  | -------------- | --------- | -------- | --------------------------------------- |
  | Authorization  | String    | true     | Access Token API를 통해 발급받은 access\_token |
  | Content-Type   | String    | true     | application/json                        |

  Example

  | 123 | `Request.setHeader("Authorization", " Bearer <Access-Token>");Request.setHeader("Content-Type", "application/json");<!--실제 요청 시 Bearer 다음의 <, >는 제외하고 access token 값만 입력해주세요-->` |
  | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

  **Request Body**: 없음

  **Response Body**:&#x20;

  | Element Name     | Data Type | Data Size | Required | Description                                   |
  | ---------------- | --------- | --------- | -------- | --------------------------------------------- |
  | startTime        | Integer   | 13        | true     | 구매한 상품의 이용시작일(ms)                             |
  | expiryTime       | Integer   | 13        | true     | 구매한 상품의 이용종료일(ms)                             |
  | nextPaymentTime  | Integer   | 13        | false    | 다음자동결제일시                                      |
  | autoRenewing     | boolean   | -         | true     | 이용종료일(expiryTime)이 지난 후 자동결제 여부               |
  | price            | Integer   | -         | true     | 상품금액                                          |
  | developerPayload | String    | 200       | false    | 개발사가 제공한 결제 고유 식별자                            |
  | purchaseState    | Integer   | 1         | true     | 구매상태(0 : 구매완료, 1 : 취소완료)                      |
  | cancelReason     | String    | 1         | false    | 해지사유 (0 : 고객요청에 의한 해지, 1 : 기타 시스템 처리로 인한 해지 ) |
  | cancelledTime    | Integer   | 13        | false    | 해지시간(ms)                                      |

  Example

  | 1234567891011 | `{  "startTime": 1345678900000,  "expiryTime": 1345678999999,  "nextPaymentTime": 1345688000000,  "autoRenewing": true,  "price": 50000  "developerPayload": "8ce0dc420c9dd244580a",  "purchaseState": 0,  "cancelReason": 1,  "cancelledTime": 1345679000000}` |
  | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

### **getLastRecurringPurchaseDetails (월정액 상품 마지막 구매 상세조회)** <a href="#id-api-getlastrecurringpurchasedetails" id="id-api-getlastrecurringpurchasedetails"></a>

* **Desc**: 월정액 상품의 최초 구매 ID로 해당 상품의 이용종료일 및 마지막(최신) 구매의 상세정보를 조회합니다.
* **URI**: https\://{host}/v2/purchase/last-recurring-details/{purchaseId}/{packageName}
* **Method**: GET
* **Parameters**:\
  &#x20;String packageName : API를 호출하는 앱의 패키지 네임 (Data Size : 128)\
  &#x20;String purchaseId : 월정액 상품의 첫 구매 ID (Data Size : 20)
* **Request Header**

  | Parameter Name | Data Type | Required | Description                             |
  | -------------- | --------- | -------- | --------------------------------------- |
  | Authorization  | String    | true     | Access Token API를 통해 발급받은 access\_token |
  | Content-Type   | String    | true     | application/json                        |

  Example

  | 123 | `Request.setHeader("Authorization", " Bearer <Access-Token>");Request.setHeader("Content-Type", "application/json");<!--실제 요청 시 Bearer 다음의 <, >는 제외하고 access token 값만 입력해주세요-->` |
  | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

  \
  **Request Body**: 없음

  **Response Body**:&#x20;

  | Element Name    | Data Type | Data Size | Required | Description                                   |
  | --------------- | --------- | --------- | -------- | --------------------------------------------- |
  | startTime       | Integer   | 13        | true     | 구매한 상품의 이용시작일(ms)                             |
  | expiryTime      | Integer   | 13        | true     | 구매한 상품의 이용종료일(ms)                             |
  | nextPaymentTime | Integer   | 13        | false    | 다음자동결제일시                                      |
  | autoRenewing    | boolean   | -         | true     | 이용종료일(expiryTime)이 지난 후 자동결제 여부               |
  | cancelReason    | String    | 1         | false    | 해지사유 (0 : 고객요청에 의한 해지, 1 : 기타 시스템 처리로 인한 해지 ) |
  | cancelledTime   | Integer   | 13        | false    | 해지시간(ms)                                      |
  | lastPurchaseId  | String    | 20        | true     | 마지막에 자동결제된 구매 ID                              |

  Example

  | 123456789 | `{  "startTime": 1345678900000,  "expiryTime": 1345678999999,  "nextPaymentTime": 1345688000000,  "autoRenewing": true,  "cancelReason": 1,  "cancelledTime": 1345679000000,  "lastPurchaseId":"15081718460701027851"}` |
  | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

### **manageRecurringPaymentStatus (자동결제해지/해지취소)** <a href="#id-api-managerecurringpaymentstatus" id="id-api-managerecurringpaymentstatus"></a>

* **Desc**: 자동결제 상태를 변경합니다.(해지 및 해지취소)
* **URI**: https\://{host}/v2/purchase/manage-payment-status/{purchaseId}/{packageName}/{action}
* **Method**: POST
* **Parameters**:\
  &#x20;String packageName : API를 호출하는 앱의 패키지 네임 (Data Size : 128)\
  &#x20;String purchaseId : 구매 ID (Data Size : 20)\
  &#x20;String action: 상태 변경 타입. cancel(자동결제 해지), reactivate(자동결제 해지취소) (Data Size : 10)
* **Request Header**

  | Parameter Name | Data Type | Required | Description                             |
  | -------------- | --------- | -------- | --------------------------------------- |
  | Authorization  | String    | true     | Access Token API를 통해 발급받은 access\_token |
  | Content-Type   | String    | true     | application/json                        |

  Example

  | 123 | `Request.setHeader("Authorization", " Bearer <Access-Token>");Request.setHeader("Content-Type", "application/json");<!--실제 요청 시 Bearer 다음의 <, >는 제외하고 access token 값만 입력해주세요-->` |
  | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

  **Request Body**: 없음

  **Response Body**:&#x20;

  | Element Name | Data Type | Data Size | Required | Description                |
  | ------------ | --------- | --------- | -------- | -------------------------- |
  | responseCode | Integer   | 1         | true     | 상태변경 성공여부 (0 : 성공, 1 : 실패) |
  | purchaseId   | String    | 20        | true     | 구매 ID                      |

  Example

  | 1234 | `{  "responseCode": 0,  "purchaseId"` `: "17103013155810111392"}` |
  | ---- | ----------------------------------------------------------------- |

### **getVoidedPurchases (구매취소 내역조회)** <a href="#id-api-getvoidedpurchases" id="id-api-getvoidedpurchases"></a>

* **Desc**: 구매취소내역을 조회합니다.
* **URI**: https\://{host}/v2/purchase/voided-purchases/{packageName}
* **Method**: GET
* **Parameters**:\
  &#x20;String packageName : API를 호출하는 앱의 패키지 네임 (Data Size : 128)
* **Optional Query Parameters :**&#x20;
  * String continuationKey : 구매취소 건이 많을 경우 원스토어 서버에서 이 값을 반환합니다. 응답에 continuationKey가 있을 경우, getVoidedPurchases를 다시 호출하면서 continuationKey를 전달하면 추가 구매취소 내역을 전달받을 수 있습니다. (Data Size : 41)
  * String startTime : 조회하고자 하는 취소건 검색 시작일 (milliseconds). 현재시간기준 과거 1개월까지만 설정가능하며 startTime 단독으로 사용할 경우 endTime은 startTime기준 미래 1개월로 설정됩니다. (Data Size : 13)
  * String endTime : 조회하고자 하는 취소건의 검색 종료일 (milliseconds). 현재시간보다 클 수 없으며 endTime 단독으로 사용할 경우 startTime은 endTime기준 과거 1개월로 설정됩니다. (Data Size : 13)
  * unsigned integer maxResults : 최대조회건수 default 100 (Data Size : 3)
* **Request Header**

  | Parameter Name | Data Type | Required | Description                             |
  | -------------- | --------- | -------- | --------------------------------------- |
  | Authorization  | String    | true     | Access Token API를 통해 발급받은 access\_token |
  | Content-Type   | String    | true     | application/json                        |

  Example

  | 123 | `Request.setHeader("Authorization", " Bearer <Access-Token>");Request.setHeader("Content-Type", "application/json");<!--실제 요청 시 Bearer 다음의 <, >는 제외하고 access token 값만 입력해주세요-->` |
  | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

  \
  **Request Body**: 없음

  **Response Body**:&#x20;

  | Element Name       | Data Type    | Data Size | Required | Description                                                                                                                                            |            |
  | ------------------ | ------------ | --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- |
  | continuationKey    | String       | 41        | false    | <p>구매취소 건이 많을 경우 원스토어 서버에서 이 값을 반환합니다. <br>응답에 continuationKey가 있을 경우, getVoidedPurchases를 다시 호출하면서 continuationKey를 전달하면 추가 구매취소 내역을 전달받을 수 있습니다.</p> |            |
  | voidedPurchaseList | Object       | -         | true     | 구매취소정보                                                                                                                                                 |            |
  | <p><br></p>        | purchaseId   | String    | 20       | true                                                                                                                                                   | 구매 ID      |
  | <p><br></p>        | purchaseTime | Integer   | 13       | true                                                                                                                                                   | 구매시간(ms)   |
  | <p><br></p>        | voidedTime   | Integer   | 13       | true                                                                                                                                                   | 구매취소시간(ms) |

  Example

  | 123456789101112131415 | `{  "continuationKey": "continuationKey",  "voidedPurchaseList": [    {        "purchaseId"` `: "17103009124410111299",        "purchaseTime"` `: 1345678900000,        "voidedTime"` `: 1345678910000    },    {        "purchaseId"` `: "17103009140030111301",        "purchaseTime"` `: 1345678930000,        "voidedTime"` `: 1345678940000    }  ]}` |
  | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

### **consumePurchase (구매상품 소비)** <a href="#id-api-consumepurchase" id="id-api-consumepurchase"></a>

* **Desc**: 구매한 상품을 소비한 상태로 변환합니다.
* **URI**: https\://{host}/v2/purchase/consume/{purchaseId}/{packageName}
* **Method**: POST
* **Parameters**:\
  &#x20;String packageName : API를 호출하는 앱의 패키지 네임 (Data Size : 128)\
  &#x20;String purchaseId : 구매 ID (Data Size : 20)
* **Request Header**

  Example

  | 123 | `Request.setHeader("Authorization", " Bearer <Access-Token>");Request.setHeader("Content-Type", "application/json");<!--실제 요청 시 Bearer 다음의 <, >는 제외하고 access token 값만 입력해주세요-->` |
  | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

  **Request Body**: 없음

  **Response Body**:&#x20;

  | Element Name     | Data Type | Data Size | Required | Description            |
  | ---------------- | --------- | --------- | -------- | ---------------------- |
  | consumptionState | Integer   | 1         | true     | 소비상태 (0 : 미소비, 1 : 소비) |
  | purchaseId       | String    | 20        | true     | 구매 ID                  |

  Example

  | 1234 | `{  "consumptionState": 0,  "purchaseId"` `: "17103013155810111392"}` |
  | ---- | --------------------------------------------------------------------- |

### **Error Response** <a href="#id-api-errorresponse" id="id-api-errorresponse"></a>

* 서버 API에서는 정상적인 응답외에 Error 발생시, JSON 형식의 별도 Response를 응답합니다. 아래 내용을 참고하시기 바랍니다.
* **Response Body : JSON 형식**

  | Element Name | Data Type | Description |       |
  | ------------ | --------- | ----------- | ----- |
  | error        | Object    | 에러정보        |       |
  | <p><br></p>  | code      | Integer     | 에러코드  |
  | <p><br></p>  | message   | String      | 에러메시지 |

  **Error Codes**

  | 분류                | Code                           | Message                        |
  | ----------------- | ------------------------------ | ------------------------------ |
  | 공통                | 9000                           | 필수값이 존재하지 않습니다.                |
  | 9001              | 조회된 결과값이 존재하지 않습니다.            |                                |
  | 9999              | 정의되지 않은 오류가 발생하였습니다.           |                                |
  | 401               | 토큰이 만료되었습니다.                   |                                |
  | getVoidedPurchase | 9100                           | 유효하지 않은 package name 입니다.      |
  | 9101              | 검색조건 규칙을 확인해 주시기 바랍니다.         |                                |
  | consumePurchase   | 9200                           | 구매내역이 존재하지 않거나, 구매완료 상태가 아닙니다. |
  | 9201              | 소비상태 변경이 불가하거나, 이미 변경완료 되었습니다. |                                |
  | 9202              | 소비상태 변경 대상이 2건 이상 존재합니다.       |                                |
  | AccessToken 발급    | 400                            | 잘못된 토큰 요청입니다.                  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://onestore-dev.gitbook.io/dev/tools/billing/old-version/v17/api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
