# 为应用One Store In-App支付做事前准备

## **商品注册** <a href="#id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-shang-pin-zhu-ce" id="id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-shang-pin-zhu-ce"></a>

有关商品注册的详细信息，请参考以下指南。

* [App Registration and Mgmt.](/dev/chi/docs/apps.md)

## **确认许可证密钥（Public Key）及OAuth认证信息** <a href="#id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-que-ren-xu-ke-zheng-mi-yao-publickey-ji" id="id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-que-ren-xu-ke-zheng-mi-yao-publickey-ji"></a>

在“公共信息 > 许可证管理”菜单中，可以查看用于服务器API的许可证密钥和OAuth认证信息。

* 许可证密钥：用于确认One Store传递的In-App支付订单是否存在伪造和篡改。
* OAuth认证信息：为了使用One Store 服务器API而进行的认证。

## **下载Sample软件** <a href="#id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-xia-zai-sample-ruan-jian" id="id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-xia-zai-sample-ruan-jian"></a>

可以在Github下载In-App支付的Sample软件。

* [下载One store In-App支付API V7(SDK V21)Sample软件](/dev/chi/tools/billing/v21/sample.md)

## **添加In-App支付library**  <a href="#id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-tian-jia-inapp-zhi-fu-library" id="id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-tian-jia-inapp-zhi-fu-library"></a>

{% hint style="warning" %}
ONE Store IAP SDK 存储库将于 **2026 年 4 月 1 日** 起迁移至 **Maven Central**。

详细信息请参考 [Notice on Migration of ONE store IAP SDK Repository](https://dev.onestore.net/devpoc/support/news/noticeView.omp?noticeId=33714)
{% endhint %}

在项目的顶层 `build.gradle` 文件中添加 ONE store 计费库依赖项。

```gradle
allprojects {
    repositories {
        ...
        mavenCentral() 
    }
}
```

以下是在应用软件的`build.gradle` 文件中添加ONE store支付library从属项目。

```gradle

dependencies {
    implementation "com.onestorecorp.sdk:sdk-iap:21.04.00"
}

```

## **安装One store应用软件**  <a href="#id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-an-zhuang-onestore-ying-yong-ruan-jian" id="id-wei-ying-yong-onestoreinapp-zhi-fu-zuo-shi-qian-zhun-bei-an-zhuang-onestore-ying-yong-ruan-jian"></a>

开发者或用户需要安装 ONE Store 应用才能使用应用内购买功能。

* [**ONE Store 应用下载指南**](/dev/chi/policy/download.md)


---

# 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/billing/v21/pre.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.
