> 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/cht/tools/one-billing-lab.md).

# ONE Billing Lab指南

<figure><img src="/files/gfI3YGTLjhf43G0uKHHf" alt=""><figcaption></figcaption></figure>

#### 📌 ONE Billing Lab作為研發工具，可以幫助研發者更容易確認ONE store服務各國家In-App付款庫綜合狀態。

* 不需要單獨安裝各服務國用的ONE store App，以希望國家會員登錄后就可以進行付款測試。
* 沒聯動實際ONE store支付系統，也可以通過ONE Billing Lab的回應模擬程式功能測試付款流程。

<figure><img src="/files/nG4i0gw0N2CRnocC3NBA" alt=""><figcaption></figcaption></figure>

## **功能介紹** <a href="#onebillinglab-gong-neng-jie-shao" id="onebillinglab-gong-neng-jie-shao"></a>

**✅ 綜合測試環境**

* 大韓民國、新加坡、臺灣、美國等所有ONE store環境中，可以僅通過ONE Billing Lab App進行測試。
* 提供統一的測試環境，減少研發公司們因各STORE套餐名不同而帶來的測試困難。

**✅ 回應模擬程式**

* 可以不通過實際付款過程，測試In-App付款場景。
* 在研發和QA環境中測試付款回應動作時使用。

**✅ 諸多付款場景測試**

* 可以測試定期付款管理、使用者認證、生物認證等諸多付款相關功能。
  * 定期付款管理功能表僅在以大韓民國和美國會員登錄時顯示。

<figure><img src="/files/LZWHdJSyJu2CmSJovYR3" alt=""><figcaption></figcaption></figure>

## **測試方法** <a href="#onebillinglab-ce-shi-fang-fa" id="onebillinglab-ce-shi-fang-fa"></a>

<figure><img src="/files/5fHB1dXBw2dfkA3l9RwV" alt=""><figcaption></figcaption></figure>

### 1. 安裝ONE Billing Lab <a href="#onebillinglab1.-an-zhuang-onebillinglab" id="onebillinglab1.-an-zhuang-onebillinglab"></a>

* 在ONE store App或GitHub下載安裝ONE Billing Lab。
  * [在ONE store App安裝](https://onesto.re/0001002700)
  * [在GitHub安裝](https://github.com/ONE-store/one_billing_lab)

### 2. 生成及登錄ONE store帳戶 <a href="#onebillinglab2.-sheng-cheng-ji-deng-lu-onestore-zhang-hu" id="onebillinglab2.-sheng-cheng-ji-deng-lu-onestore-zhang-hu"></a>

* 啟動ONE Billing Lab后，選擇測試國家或地區，生成或登錄ONE store帳戶。
  * ONE Billing Lab會員和原有會員一致。
* 若原有ONE store帳戶，可以直接進行第三階段。
* 沒有帳戶的，可在ONE Billing Lab簡單加入會員。

<figure><img src="/files/6VS4OtSFmf8RWqVEQj46" alt=""><figcaption></figcaption></figure>

### 3.註冊測試ID <a href="#onebillinglab3.-zhu-ce-ce-shi-id" id="onebillinglab3.-zhu-ce-ce-shi-id"></a>

* 在ONE store研發者中心測試App中，以付款測試ID註冊ONE store帳戶。
* 註冊時可以選擇付款環境。
  * Sandbox
  * Commercial (商用測試)
* 參考 :  [註冊測試ID](https://onestore-dev.gitbook.io/dev/cht/tools/billing/v21/test#inapp-zhi-fu-ce-shi-ji-an-quan-xing-zhu-ce-ce-shi-id)

<figure><img src="/files/RphFuMFkJtwN5UM5Tj2I" alt=""><figcaption></figcaption></figure>

### 4. App 聯動設置 <a href="#onebillinglab4.app-lian-dong-she-zhi" id="onebillinglab4.app-lian-dong-she-zhi"></a>

* 設置聯動測試的研發者App的 `AndroidManifest.xml`檔案。
  * 為了指定商店，把研發者選項（`onestore：dev_option`的`android：value` 值）設置為`onestore_03`。

<pre class="language-xml"><code class="lang-xml">&#x3C;manifest>
    &#x3C;application>
<strong>        &#x3C;meta-data android:name="onestore:dev_option" android:value="onestore_03" />
</strong>    &#x3C;/application>
&#x3C;/manifest>
</code></pre>

* 參考: [選擇商店設置開發者選項](https://onestore-dev.gitbook.io/dev/cht/tools/billing/v21/sdk#undefined-3)

### 5. 進行付款測試 <a href="#onebillinglab5.-jin-xing-fu-kuan-ce-shi" id="onebillinglab5.-jin-xing-fu-kuan-ce-shi"></a>

* 運行研發者App試圖付款。
* 按照註冊ONE store帳戶的國家和研發者中心設置的付款環境基準，顯示付款畫面。
* 例如\
  : 美國會員 + 商用付款環境 → 顯示實際付款畫面和付款手段，實際付款功能

<figure><img src="/files/C1jLOlNQ5gQhC4jrHuP6" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
為進行在商用測，必須在 ONE store Developer Center 登記 Binary。
{% endhint %}

| 條件         | 商用測試 (uploadKey) | 商用測試 (store signingKey) | Sandbox 測試 | 備註           |
| ---------- | ---------------- | ----------------------- | ---------- | ------------ |
| 未登記 Binary | ✖ 不可             | ✖ 不可                    | ✔ 可行       | 僅可使用 Sandbox |
| 已登記 Binary | ✔ 可行             | ✔ 可行                    | ✔ 可行       | 通過簽名驗證後全     |

### 6. 確認付款記錄及取消付款 <a href="#onebillinglab6.-que-ren-fu-kuan-ji-lu-ji-qu-xiao-fu-kuan" id="onebillinglab6.-que-ren-fu-kuan-ji-lu-ji-qu-xiao-fu-kuan"></a>

* 可以在ONE store研發者中心確認付款記錄。
* 需要時可以親自處理取消付款。
