# 為套用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.](https://onestore-dev.gitbook.io/dev/cht/docs/apps)

## **確認許可證密鑰（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而進行的認證。<br>

## **下載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軟件](https://onestore-dev.gitbook.io/dev/cht/tools/billing/v21/sample)

## **添加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

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

```

以下是在應用軟件的`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 應用程式下載指南**](https://onestore-dev.gitbook.io/dev/cht/policy/download)
