# ONE store In-App支付發布说明

### ONE Billing Lab發售 <a href="#id09.onebillinglab-fa-shou" id="id09.onebillinglab-fa-shou"></a>

ONE Billing Lab作為研發工具，支援 ONE store In-App付款庫統一測試。

可通過大韓民國、新加坡、臺灣、美國各國家/地區的帳戶登錄進行付款測試，不需要為了付款測試安裝各國家/地區的所有商店App。

可以不使用實際付款系統，僅使用回應模擬程式功能測試付款流程。

可以在 ONE store App或GitHub下載 ONE Billing Lab。

* [在ONE store App安裝](https://onesto.re/0001002700)
* [在GitHub安裝](https://github.com/ONE-store/one_billing_lab)

{% hint style="info" %}
需要在 ONE store 研發者中心註冊付款測試ID才能進行測試。（Sandbox或在商用測）

ONE Billing Lab會員和 ONE store 會員一致。 可用原有帳戶在ONE Billing Lab註冊，在ONE Billing Lab進行加入/退出會員也按照 ONE store 會員加入程式。
{% endhint %}

### ONE store In-App支付SDK 21.01 發行

ONE store In-App支付（内部App支付）SDK 21.01 已經發行。

主要變更事項如下。

* 解決了與檢測App健全性的網絡安全解決方案不兼容的問題。&#x20;
* 解決了安裝有韓国One store App時，下载安裝全球One store App動線中發生的加載問題。&#x20;
* 提供在研發階段可以改變研發環境的設置。提供以下兩種設置，可以選擇國内One store和全球One store進行研發的環境。&#x20;

### **ONE store In-App支付library API V7(SDK V21)** 發**布** <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-onestoreinapp-zhi-fu-libraryapiv7sdkv21-fa-bu" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-onestoreinapp-zhi-fu-libraryapiv7sdkv21-fa-bu"></a>

ONE store In-App支付library API V7(SDK V21.00)現已發布，主要變更事項如下。 &#x20;

新商品必須應用ONE store In-App支付library API V7(SDK V21)。&#x20;

應用ONE store In-App支付API V5(SDK V17)以上的應用軟件可以遷移到API V7(SDK V21)。&#x20;

由於ONE store In-App支付API V4(SDK V16)的設計結構與之後的版本完全不同，因此無法遷移到ONE store In-App支付API V6(SDK V19)。&#x20;

#### 訂閱型商品 <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-ding-yue-xing-shang-pin" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-ding-yue-xing-shang-pin"></a>

代替SDK V19以下版本中使用的包月型商品而提供訂閱型商品。&#x20;

訂閱型商品不僅提供用戶在ONE store應用軟件内直接管理定期支付商品的多種功能，還為開發者提供各種功能，例如為新用戶流入的促銷活動、定期支付狀態變更的通知功能等。 \
&#x20;

### **ONE store In-App支付library API V6(SDK V19)** 發**布** <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-onestoreinapp-zhi-fu-libraryapiv6sdkv19-fa-bu" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-onestoreinapp-zhi-fu-libraryapiv6sdkv19-fa-bu"></a>

ONE store In-App支付library API V6(SDK V19.00)現已發布，主要變更事項如下。&#x20;

新商品必須應用ONE store In-App支付library API V6(SDK V19)。&#x20;

應用ONE store In-App支付API V5(SDK V17)的應用軟件可以遷移到API V6(SDK V19)。&#x20;

由於ONE store In-App支付API V4(SDK V16)的設計結構與之後的版本完全不同，因此無法遷移到ONE store In-App支付API V6(SDK V19)。&#x20;

<br>

#### 刪除ONE store In-App支付API版本 <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-shan-chu-onestoreinapp-zhi-fu-api-ban-ben" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-shan-chu-onestoreinapp-zhi-fu-api-ban-ben"></a>

現在，您無需在應用軟件的manifest中添加In-App API版本。&#x20;

In-App支付SDK V19將添加API Version meta-data。&#x20;

#### 確認購買 <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-que-ren-gou-mai" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-que-ren-gou-mai"></a>

如果軟件使用的是ONE store In-App支付library API  v6（SDK 19）以上版本，則必須在3天内進行購買確認。&#x20;

如果在3天内無法確認購買，將被認為item無法正常支付，並取消購買。&#x20;

可以使用以下method之一確認購買：&#x20;

* 對於消耗性產品，請使用PurchaseClient.consumeAsync()。&#x20;
* 非消耗性產品，請使用PurchaseClient.acknowledgeAsync()。&#x20;

對於包月型商品，只需確認首次支付的購買即可。

{% hint style="info" %}
如果應用了ONE store In-App API V6(SDK V19)，則必須在3天内進行購買確認。&#x20;

請注意，如果3天内未確認購買，購買將被取消。&#x20;
{% endhint %}

#### 獲取市場分類代碼 <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-huo-qu-shi-chang-fen-lei-dai-ma" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-huo-qu-shi-chang-fen-lei-dai-ma"></a>

從IAP library V6開始，為了使用Server to Server API，需要市場分類代碼。&#x20;

可以通過getStoreInfoAsync()獲取市場分類代碼。&#x20;

#### 變更PurchaseClient API <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-bian-geng-purchaseclientapi" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-bian-geng-purchaseclientapi"></a>

|                        | **V5 (SDK V17)**            | **V6(SDK V19)**             |
| ---------------------- | --------------------------- | --------------------------- |
| 與**支付模塊的連接**           | connect                     | startConnection             |
| **斷開與支付模塊的連接**         | terminate                   | endConnection               |
| 確認**是否支持**             | isBillingSupportedAsync     | X                           |
| 購買**In-App商品**         | launchPurchaseFlowAsync     | launchPurchaseFlow          |
| **使用In-App商品**         | consumeAsync                | consumeAsync                |
| **In-App商品購買確認**       | X                           | acknowledgeAsync            |
| **未使用商品的訂單（包括每月自動支付）** | queryPurchasesAsync         | queryPurchasesAsync         |
| **In-App商品詳情**         | queryProductsAsync          | queryProductDetailsAsync    |
| **更改每月自動支付狀態**         | manageRecurringProductAsync | manageRecurringProductAsync |
| **更新或安裝支付模塊**          | launchUpdateOrInstallFlow   | launchUpdateOrInstallFlow   |
| 調**用ONE store登錄**      | launchLoginFlowAsync        | launchLoginFlowAsync        |
| **確認市場分類代碼**           | X                           | getStoreInfoAsync           |

#### 變更Server API  <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-bian-geng-serverapi" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-bian-geng-serverapi"></a>

| 區**分** | **API目錄**             | **API URI**                                                               |                                                                                        | **变更事项**                                                                                                              |
| ------ | --------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|        |                       | **V6 (SDK V19)**                                                          | **V6 (SDK V19)**                                                                       |                                                                                                                       |
| 變更     | 發放OAuth token         | /v2/oauth/token                                                           | /v6/oauth/token                                                                        | <p>在响应规格里删除status字段<br>使用Http response code检查是否正常(200)</p>                                                            |
| 刪除     | 購買商品詳情查詢              | /v2/purchase/details/{purchaseId}/{packageName}                           | N/A                                                                                    | <p>为加强安全性，删除购买商品详情查询API<br>整合为购买商品详情查询By In-App商品ID</p>                                                               |
| 變更     | 購買商品詳情查詢By In-App商品ID | /v2/purchase/details-by-productid /{purchaseId}/{packageName}/{productId} | /v6/apps/{packageName}/purchases/inapp/products /{productId}/{purchaseToken}           | 在响应规格里添加 purchaseId, acknowledgeState 字段                                                                              |
| 變更     | 包月型商品購買詳情查詢           | /v2/purchase/recurring-details/{purchaseId}/{packageName}                 | /v6/apps/{packageName}/purchases/auto/products /{productId}/{purchaseToken}            | <p>在响应规格里添加 acknowledgeState, lastPurchaseId, lastPurchaseState<br>在响应规格里删除price, developerPayload, purchaseState</p> |
| 刪除     | 包月型商品最後購買訂單詳情查詢       | /v2/purchase/last-recurring-details/{purchaseId}/{packageName}            | N/A                                                                                    | 整合为包月型商品购买详情查询API                                                                                                     |
| 變更     | 解除自動支付                | /v2/purchase/manage-payment-status/{purchaseId}/{packageName}/cancel      | /v6/apps/{packageName}/purchases/auto/products /{productId}/{purchaseToken}/cancel     | 变更成功处理响应规格                                                                                                            |
| 變更     | 取消解除自動支付              | /v2/purchase/manage-payment-status/{purchaseId}/{packageName}/reactivate  | /v6/apps/{packageName}/purchases/auto/products /{productId}/{purchaseToken}/reactivate | 变更成功处理响应规格                                                                                                            |
| 變更     | 取消購買訂單查詢              | /v2/purchase/voided-purchases/{packageName}                               | /v6/apps/{packageName}/voided-purchases                                                | <p>为了提高API的易用性，购买取消订单查询标准(startTime, endTime)从购买日变更为购买取消日<br>在响应规格添加 purchaseToken, marketCode</p>                    |
| 變更     | 使用購買商品                | /v2/purchase/consume/{purchaseId}/{packageName}                           | /v6/apps/{packageName}/purchases/all/products/ {productId}/{purchaseToken}/consume     | 变更成功处理响应规格                                                                                                            |
| 添加     | 購買確認                  | N/A                                                                       | /v6/apps/{packageName}/purchases/all/products/ {productId}/{purchaseToken}/acknowledge | 添加新的购买确认API                                                                                                           |

&#x20;\
&#x20;

#### 變更PNS消息規格  <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-bian-geng-pns-xiao-xi-gui-ge" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-bian-geng-pns-xiao-xi-gui-ge"></a>

* 為了支持韓幣以外的貨幣，支付金額（price）的數據類型從Number變更為String。&#x20;
* 為了支持韓幣以外的貨幣，增加了支付金額的貨幣代碼（priceCurrencyCode）。&#x20;
* 為了支持韓幣以外的貨幣，按支付方式分類的金額（amount）的數據類型Number改為String。&#x20;
* 在回應規格中添加了purchaseToken，environment和marketCode字段。&#x20;

詳細規格可在[PNS消息詳細變更歷史紀錄](https://onestore-dev.gitbook.io/dev/cht/tools/billing/v21/pns)中查看。\
&#x20;

### **ONE store In-App支付 library API V5(SDK V17)**   <a href="#onestoreinapp-zhi-fu-fa-bu-shuo-ming-onestoreinapp-zhi-fu-libraryapiv5sdkv17" id="onestoreinapp-zhi-fu-fa-bu-shuo-ming-onestoreinapp-zhi-fu-libraryapiv5sdkv17"></a>

* API版本必須在開發公司應用軟件的"AndroidManifest.xml"文件中如下注明。&#x20;

* 有關更多資訊，請參見應用In-App支付的前期準備頁上的"Android Manifest文件設置"部分。&#x20;

* API V5（SDK V17）中的改進包括:&#x20;

<table data-header-hidden><thead><tr><th width="145.33333333333331">項目</th><th> 詳細改進項目</th><th>說明</th></tr></thead><tbody><tr><td><strong>API</strong></td><td>引入Consume概念</td><td>發生未發放item情况時，提供從應用軟件中恢復的邏輯。</td></tr><tr><td></td><td>支持Custom PID</td><td>開發者可以直接輸入In-App商品ID(PID)，通過直觀的PID創建和操作。</td></tr><tr><td></td><td>提供通用的In-App支付interface</td><td>以其他市場為方向開發的應用軟件，無需在編碼投入開發時間，即可向ONE store方向啟動。</td></tr><tr><td><strong>支付測試環境</strong></td><td>分别提供開發環境和商用環境</td><td><p>提供與開發公司的驗證環境相同水平的ONE store支付環境。<br>在開發公司的開發環境中，可以與ONE store Sandbox聯合開發/測試，在開發公司的商用環境中，可以在ONE store商用環境中進行實際支付。<br>在ONE store開發者中心以測試ID註冊的ID登錄到ONE store後，在實際支付的情况下，開發者可以自由地取消購買。</p><table data-header-hidden><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody><tr><td>區分</td><td><br></td><td>開發者</td><td><br></td></tr><tr><td><br></td><td><br></td><td><strong>開發環境</strong></td><td><strong>商用環境</strong></td></tr><tr><td>ONE store支付環境</td><td><strong>Sandbox</strong></td><td>O</td><td>-</td></tr><tr><td><br></td><td><strong>商用環境 (實際支付)</strong></td><td>-</td><td>O</td></tr></tbody></table></td></tr><tr><td><strong>支付窗口UI</strong></td><td>可選擇全屏支付和彈窗支付界面</td><td>您可以選擇全屏支付或彈窗支付（彈窗支付指南）。<br>支付界面設置請參考應用In-App支付的前期準備页的"Android Manifest文件設置"部分。</td></tr><tr><td><strong>連動方式</strong></td><td>可選擇IAP SDK, AIDL</td><td>除了傳統的SDK方法，您還可以使用AIDL直接與OSS進行聯動。<br>但是，在沒有安裝ONE store service（OSS）應用軟件的智能手機上，In-App支付不能正常工作。<br>有關安裝ONE store service應用軟件的内容，請參考應用In-App支付的前期準備頁上的"ONE store應用軟件安裝"部分。</td></tr><tr><td><p></p><p><strong>開發者中心</strong></p></td><td>改進其他應用市場應用軟件商品資訊抓取功能</td><td><p>您可以輕鬆地將已註冊的其他用市場的應用軟件商品註冊到ONE store。</p><p><br></p></td></tr><tr><td></td><td>提供其他應用市場In-App商品資訊導入功能</td><td></td></tr><tr><td><strong>認證中心</strong></td><td>OAuth發放/認證/管理</td><td>加強開發者伺服器與ONE store In-App支付伺服器聯動時的數據安全性。</td></tr></tbody></table>


---

# Agent Instructions: 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:

```
GET https://onestore-dev.gitbook.io/dev/cht/tools/billing/v21/releasenote.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
