Skip to content

Omnilatent/OmniInAppPurchaseHelper

Repository files navigation

Git repository: https://github.com/Omnilatent/OmniInAppPurchaseHelper

Dependencies:

  • Unity In App Purchasing 4.4.1.
  • Unity Services Core 1.4.0.

SETUP:

Setup Unity IAP:

Prepare IAP Products:

  • Google Play Store:
    • Build an APK to upload to Google Play alpha build.
    • Create IAP product in Google Play Console.
  • Apple App Store: (Support Coming soon)

Setup in Unity project:

  • Add a gameObject with component InAppPurchaseHelper in your first scene.
  • Import Extra files: Go to Tools/Omnilatent/IAP Helper/Import Extra Package.
  • Modify HandleIAPEvent (in Assets/Omnilatent/Extra/IAPHelperExtra/HandleIAPEvent.cs):
    • In PayoutPurchase(), handle what will happens when user successfully purchase a product. You can check payout's type and subtype.
    • In OnPurchaseComplete(), a placeholder message popup is shown when purchase is successful, modify this behaviour to your need.
  • Create IAPProductData Scriptable Objects with correspond name to every products in folder "Resources/ProductData".
  • Setup payout for each IAPProductData you created.
  • Make sure an Assembly Definition Reference to "Omnilatent.InAppPurchaseHelper" exist in the same folder as the "Tangle" class generated by IAP Receipt Validation Obfuscator.

USAGE:

Buying product: InAppPurchaseHelper.Instance.BuyProduct(productId, onPurchaseComplete).

Adding remove ads:

  • Make Product on Google Play Console
  • Add all remove ads product to removeAdsProducts list in InAppPurchaseHelper. It'll check for remove ads on initiation.
  • Use InAppPurchaseHelper.BuyProduct(string productId, PurchaseCompleteDelegate purchaseCompleteDelegate) to initiate purchasing process.
  • Add HandleIAPEvent class to your project:

Get & display product's price with currency symbol: use component ProductPriceText.

Checking user's ownership of product: use InAppPurchaseHelper.CheckReceipt(productId).

Features & Explaination:

InitializePurchasing:

  • All IAPProductData in Resources/ProductData will be loaded and added by ConfigurationBuilder.

Example: [Updated] Extra script is now included in Extra package

  • A message should be displayed in purchaseCompleteDelegate's code to announce purchase result.

About

In app purchase helper using Google Billing

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages