Version: 2022.3
言語: 日本語
Unity IAP の設定
Google Play ストアの設定

Apple App Store と Mac App Store の設定

前書き

ここでは、Unity のゲームでアプリ内課金ストアを利用するのに必要な、デジタルレコードと関連を構築する手順を説明します。Unity IAP 課金 API がターゲットとなります。

アプリ内課金 (IAP) は、お金とデジタルプロダクトとを取引する過程です。プラットフォームのストアでは、デジタルプロダクトである製品を購入することが可能です。プロダクトには、たいてい文字列データタイプである ID と、有効な期間を表すタイプが与えられています。タイプは、subscriptionconsumable (再購入可能)、 non-consumable (1度だけ購入可能) が一般的です。

Apple App Store

はじめに

  1. Write a game implementing Unity IAP. Refer to Unity IAP Initialization.

  2. 後で、iTunes Connect で使用するために、手元にゲームのプロダクト ID を控えておきます。

アプリケーションの登録

  1. Apple Developer Center で、該当する ID セクションを探します。

  2. 新しい App ID を加え、Apple の基本アプリケーション情報を作成します。

    NOTE: Use an Explicit App ID. You cannot use Wildcard App IDs (com.example.*) for applications that use In-App Purchases.

    注意 App ID は Developer Center で作成したあとに iTunes Connect で使用できます。

  3. iTunes Connect を開き、App を作成し、ゲームとストアとの関連付けをします。

  4. 新しく作成した App ID をアプリケーションの Bundle ID に使用します。

アプリ内課金システム情報の追加

  1. 新しいアプリの Features を選択し、+ ボタンを押して新しい In-App Purchase を加えます。

  2. プロダクトタイプ を選択します。

  3. Product ID を 指定し、必要に応じて他のフィールドを記入します。

    Note: The “Product ID” here is the same identifier used in the game source code, added to the Unity IAP ConfigurationBuilder instance by using AddProduct() or AddProducts().

    Note: When targeting multiple Apple device groups (for example, shipping on both iOS and Mac) Apple requires usage of different, unique product identifiers for each distinct device group. Use Unity IAP’s Purchasing.IDs class and define a one-to-many mapping Product IDs to the store-specific identifiers, and pass that mapping in when initializing IAP.

  4. 結果

IAP のテスト

  1. Create Sandbox Testers using iTunes Connect for use on your test device’s iTunes Account. To do this, go to iTunes Connect > Users and Roles, and choose the plus (“+”) button. You must review Apple’s Sandbox Tester documentation as there are several additional important usage notes, and you must use a real email address to create Testers.

    Note: For more information, refer to the iOS and Mac App Store guides.

    Tip: To simplify managing the email address, use an email service capable of sub-addressing (emailaccount+subaddress@example.com) such as Gmail, iCloud, and Outlook.com. This allows one email account to receive email for multiple sub-addresses.

  2. Complete the user creation wizard.

  3. Build the Xcode project for your game by using Unity.

    Note: Ensure the Bundle Identifier in Unity (Edit > Project Settings, then select the Other Settings category, and navigate to the Bundle Identifier section) matches that used in iTunes Connect.

  4. In your game’s Xcode project, ensure the Team (Project Navigator > your game Target > General > Identity > Team) is set to that of your Apple Developer account.

iOS の場合

  1. ターゲットになる iOS デバイスを使って、存在する Apple ID アカウントすべてからサインアウトし、アプリケーションの指示で Sandbox Tester としてサインインします。その後の購入はすべて、Production Store ではなく Apple Sandbox を通して送られます。

  2. Build and run the game on your iOS device. UnityPurchasing.Initialize() succeeds if everything has been correctly configured.

  3. デバイス上のゲームでなにかを購入して、IAP をテストします。変更された購入ダイアログが表示され、この購入が実際、Sandbox 環境で実行されたとことを示します。購入の際に、パスワードの入力をもとめられたら、Sandbox User Tester のパスワードを使用してください。

    Warning: If the indicator is not present, then an account is charged real money for the product.

Mac の場合

  1. デスクトップのMacビルドをビルドする場合は、UnityのMac Player 設定で Mac App Store Validation を選択します。

  2. After you have built your App, update its info.plist file with your bundle identifier and version strings. Right-click the .app file and select Show Package Contents, locate the info.plist file and update the CFBundleIdentifier string to your application’s bundle identifier.

  3. アプリケーションに署名し、パッケージし、インストールします。your.app と your.pkg を適切に入力し、以下のコマンドを OSX ターミナルから実行します。

    Tip: To sign the bundle, you might first need to remove the Contents.meta file if it exists: your.app/Contents/Plugins/unitypurchasing.bundle/Contents.meta

    1. codesign -f --deep -s "3rd Party Mac Developer Application: " your.app/Contents/Plugins/unitypurchasing.bundle

    2. codesign -f --deep -s "3rd Party Mac Developer Application: " your.app

    3. productbuild --component your.app /Applications --sign "3rd Party Mac Developer Installer: " your.pkg

  4. To install the package correctly, delete the unpackaged .app file before you run the newly created package and install it.

  5. アプリケーション フォルダーからアプリを起動します。初回に iTunes アカウントの情報を入力すると、Sandbox 環境でテスト購入できるようになります。

For more information on Apple App Store testing and signing, refer to iOS and Mac Extended Functionality and Building your macOS application.

Unity IAP の設定
Google Play ストアの設定