ここでは、Unity のゲームでアプリ内課金ストアを利用するのに必要な、デジタルレコードと関連を構築する手順を説明します。Unity IAP 課金 API がターゲットとなります。
アプリ内課金 (IAP) は、お金とデジタルプロダクトとを取引する過程です。プラットフォームのストアでは、デジタルプロダクトである製品を購入することが可能です。プロダクトには、たいてい文字列データタイプである ID と、有効な期間を表すタイプが与えられています。タイプは、subscription、 consumable (再購入可能)、 non-consumable (1度だけ購入可能) が一般的です。
Unity IAP を実装するゲームを作成します。Unity IAP 初期化 と Sample IAP Project を参照してください。
後で、Google Play デベロッパーコンソールで使用するために、手元にゲームのプロダクト ID を控えておきます。
リリース版で署名された Android APK をビルドします。
TIP: キーストアファイルが安全に保存されているかを確認してください。オリジナルのキーストアは アプリの更新で Google Play のアプリを公開するときに常に必要です。
ヒント: 変更した APK を Developer Console に読み込むことを最初に要求されずにサイドローディングできるよう、ローカルテストの間は最後にアップロードした APK の Bundle Version Code を再利用します。Android Player の設定を参照してください。
ゲームをパブリッシュする Google アカウントを使って、Google Play デベロッパーコンソール で Android アプリケーションを登録します。
ノート: ここでは、アプリ内課金の統合をテストするのに Google Play Billing Library 統合をテストする を使用しています。
Create app を選択します。
アプリケーションに App 名を付け、ゲームに適したオプションを選択します。
左側ペインで Testing/Closed testing に移動し、 Create track を選択します。APK を選択し、アップロードします。また、基本的なダッシュボードの要件を設定し、スクリーンショットをアップロードし、Short と Full の説明を加えます。また、Internal (内部) テストトラックを作成することもできます。
最初のバイナリがアップロードできたので、IAP 製品を追加できます。
In-app Products に移動し、Create product を選択します。
Product ID (製品 ID)、製品の詳細と価格を定義します。保存後、製品を有効にすることを忘れないでください。
Managed product** を選択して、consumable (消費型) か non-consumable (非消費型) を特定できます。 **Subscription_ も Unity IAP でサポートされています。
ノート: この “Product ID” は、ゲームのソースコードで使用されるのと同じ識別子で、“gold50” のように、 AddProduct()
や AddProducts()
を通じて Unity IAP ConfigurationBuilder インスタンスに加えられます。
ライセンステストにテスターを追加します。
Google Developer ダッシュボードで All Apps に移動します。
Settings/License Testing を選択します。各 Google アカウントを加えます。変更を保存します。
ノート: APK を公開してから数時間の遅延が発生する場合があります。
ノート: IAP 内の無料購買の許可が更新されていることをテストするために、ストアからダウンロードされた既存の APK インストールを更新して、アプリケーションをサイドロードすることができます。
IAP をテストするには、テスターの Google アカウントでログインし、デバイスでアイテムを購入します。改訂された購入ダイアログが表示されるので、テスト環境で無料で購入していることを確認できます。
注意: このダイアログボックスが表示されない場合は、テスターの Google アカウントに実際の製品の料金が課金されます。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.