/IAP_unity

Manager for UnityIAP (ScriptableObject based)

Primary LanguageC#

IAP unity based

Unity Version Unity Version

Table of Contents
  1. How to add IAP to project
  2. How to create and configure IAP_Data files
  3. How IAP package work

!!! WARNING !!!

Folder in Plugins/UnityChannels Must be Deleted if exist! Otherwise Google Play will Ban your application with message AliPay wanna permission to phone number

How to add IAP to project

  • PackageManager.UnityIAP Update to version 4.1.3
  • Enable UnityAnalytics and UnityIAP services
  • Add GooglePlay public key to UnityIAP
  • Create UnityIAP Tangles => Obfuscate GooglePublicKey
  • Coppy file .asmdef from Samples~/TagleAsmdef~/ to folder with generated Tangles (Assets/Plugins/UnityPurchasing/Generated/)
  • Download package Google IAP plugin => google-play-plugins-1.6.0.unitypackage
  • Import this package to project
  • If needed Enable #define RECEIPT_VALIDATION
  • Drop to scene prefabButton from Samples~ or create your own prefab with script IAP_Button.cs
  • Assign IAP_Data file to button

How to create and configure IAP_Data files

  • Create IAP_Data file. Has 2 ways:

    • First is BETTER
    • Second
    Keep in mind
      - All IAP_Data files must be plase in `Resources/IAP/Data/`
      - IAP_manager must be plase in `Resources/IAP/`

Configure IAP_Data file

How IAP package work

  • When IAP_Buttton OnEnable => static IAP_InitializeBroker.TryOnCheck();
  • static IAP_InitializeBroker Check internet connection.
    • If need, in this stage you can block interface by NoInternetConnection
  • Only if online static IAP_InitializeBroker initilize IAP_manager
  • When user click to IAP_Button => IAP_InitializeBroker.TryOnCheck(callback with action for buy if internetON);
  • if networkOn, static IAP_InitializeBroker invoke callback (where IAP_data object waiting)
  • IAP_data object invoke IAP_manager for buy item
  • if IAP_manager complete transaction, then invoke IAP_data for reward

  • All rewards must be configured in IAP_data file in UnityEvent
  • No_Internet_Message - handled by other package
  • No_Internet_callback - handled by other package