# ONE Billing Lab指南

<figure><img src="https://2757207078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG1QmZshNU0saLqpjlDho%2Fuploads%2FRsAereWTjNtkVdDVPAs1%2Fimage.png?alt=media&#x26;token=8330f0f8-c286-424a-a706-00cc7cb29ff4" alt=""><figcaption></figcaption></figure>

#### 📌 ONE Billing Lab作为研发工具，可以帮助研发人员更容易确认ONE store服务各国家In-App支付库综合状态。

* 不需要单独安装各服务国用的ONE store App,以希望国家会员登录后就可以进行支付测试。
* 没联动实际ONE store支付系统，也可以通过ONE Billing Lab的响应模拟程序功能测试支付流程。

<figure><img src="https://2757207078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG1QmZshNU0saLqpjlDho%2Fuploads%2FKRfpIvOIEDSCiFE9g1qk%2Fimage.png?alt=media&#x26;token=c6d4012b-534b-41f4-97a7-13d1b32ef311" 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="https://2757207078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG1QmZshNU0saLqpjlDho%2Fuploads%2Fb4OlzOilzZxXoOoJDJLe%2Fimage.png?alt=media&#x26;token=98c5f346-b928-491d-89f7-79a1b83759c5" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2757207078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG1QmZshNU0saLqpjlDho%2Fuploads%2FnUE40rOYhFZmEVGh2oNU%2Fimage.png?alt=media&#x26;token=1212f9d6-f607-427b-a18d-7d9fce62b7c4" 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="https://2757207078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG1QmZshNU0saLqpjlDho%2Fuploads%2FDNnmcF0KMT0rwavMDPZL%2Fimage.png?alt=media&#x26;token=3a8a19b4-677b-4199-823c-9b020c162213" 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/chi/tools/billing/v21/test#inapp-zhi-fu-ce-shi-ji-an-quan-xing-zhu-ce-ce-shi-id)

<figure><img src="https://2757207078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG1QmZshNU0saLqpjlDho%2Fuploads%2FsIyzAPMkTT7yejODxzhn%2Fimage.png?alt=media&#x26;token=03c30a27-4ea1-44f7-86ee-a225feca6eb5" 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/chi/tools/billing/v21/sdk#undefined-3)

### 5. 进行支付测试 <a href="#onebillinglab5.-jin-xing-zhi-fu-ce-shi" id="onebillinglab5.-jin-xing-zhi-fu-ce-shi"></a>

* 运行研发者App试图支付。
* 按照注册ONE store账户的国家和研发者中心设置的支付环境基准，显示支付画面。
* 例如\
  ：美国会员 + 商用支付环境 → 显示实际支付画面和支付手段，实际支付功能

<figure><img src="https://2757207078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG1QmZshNU0saLqpjlDho%2Fuploads%2FYB9ntJjb4A1afnwLquDh%2Fimage.png?alt=media&#x26;token=ed253ef5-2566-4c43-8026-429725007858" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
为进行商用测试，必须在 ONE store Developer Center 注册 Binary。
{% endhint %}

| 条件         | 商用测试 (uploadKey) | 商用测试 (store signingKey) | Sandbox 测试 | 备注           |
| ---------- | ---------------- | ----------------------- | ---------- | ------------ |
| 未注册 Binary | ✖ 不可             | ✖ 不可                    | ✔ 可行       | 仅可使用 Sandbox |
| 已注册 Binary | ✔ 可行             | ✔ 可行                    | ✔ 可行       | 通过签名验证后全部允许  |

### 6. 确认支付记录及取消支付

* 可以在ONE store研发者中心确认支付记录。
* 需要时可以亲自处理取消支付。


---

# 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/chi/tools/one-billing-lab.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.
