Version: 2022.2
针对 Apple App Store 和 Mac App Store 进行配置
针对 Windows 应用商店进行配置

针对 Google Play 应用商店进行配置

简介

本指南介绍如何建立 Unity 游戏与应用内购 (IAP) 商店进行交互所需的数字记录和关系。本指南针对的是 Unity IAP 购买 API。

应用内购 (IAP) 是通过资金交易购买数字商品的过程。一个平台的应用商店会允许购买代表数字商品的产品。这些商品有一个标识符(通常是字符串数据类型)。商品的类型 (Types) 可表示其耐用性:_订阅消耗品_(可以多次购买)以及_非消耗品_(可以购买一次)是最常见的类型。

Google Play 应用商店

准备开始

  1. Write a game implementing Unity IAP. See Unity IAP Initialization and the Sample IAP Project.

2.准备好游戏的商品标识符以便稍后在 Google Play Developer Console(开发者控制台)中使用。

![gold50](../uploads/Main/IAPGoogleImage0.png)
  1. Build a signed non-Development Build Android APK from your game.

    提示:务必妥善保存您的密钥库文件。始终需要原始密钥库来更新已发布的 Google Play 应用程序。

    提示:在本地测试期间,请复用您上次上传的 APK 的 Bundle Version Code 以便允许侧载 (side-loading),无需先将已更改的 APK 上传到 Developer Console。请参阅 Android 平台 Player 设置

注册应用程序

通过用于发布游戏的 Google 帐户,将 Android 应用程序注册到 Google Play Developer Console

NOTE: This guide uses the Google Play License Testing approach for testing in-app purchase integration.

  1. Choose Create app.

    All apps
    All apps
  2. Give the application an App name and select the appropriate options for your game.

    Create app
    Create app
  3. Navigate to Testing/Closed testing in the left nav and choose Create track. Select your APK and upload it. Also complete the basic Dashboard requirements, upload screenshots and add a Short and Full description. You can also create an Internal test track.

    Closed testing
    Closed testing

添加 IAP

Now that you have uploaded our first binary, you can add the IAP products.

  1. Navigate to In-app Products and choose Create product.

    In-app products
    In-app products
  2. Define the Product ID , product details and price. Remember to activate the product after saving.

    您可以在 Managed product 中指定消耗品或非消耗品商品类型。Unity IAP 也支持 __Subscription__(订阅)商品类型。

NOTE: The “Product ID” here is the same identifier used in the game source code, added to the [Unity IAP ConfigurationBuilder] instance via AddProduct() or AddProducts(), like “gold50”.

50goldcoins
50goldcoins

测试 IAP

Add your testers to License Testing.

  1. Navigate to All Apps on your Google Developer dashboard.

  2. Select Settings/License Testing. Add each Google Account email address. Save changes.

License testing

NOTE: There may be a delay of several hours from the time you publish the APK. 
  1. When available, share the Join on Android link with testers. Ensure that testers can install the application from the store.

Note: To test updates retaining permission to purchase IAPS’s for free, you may side-load applications, updating the existing store-downladed APK install.

My closed Track
My closed Track
  1. To test the IAP, make a purchase on a device logged in with a Tester Google Account. A modified purchase dialog box appears to confirm the fact this product is under test and is free.

    WARNING: If this dialog box does not appear, then the Tester Google Account will be charged real money for the product.

针对 Apple App Store 和 Mac App Store 进行配置
针对 Windows 应用商店进行配置
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961