Here's a formatted version for your GitHub README:
The repository contains two projects: a Unity project and an Android project.
A native Java library is developed that integrates seamlessly with Unity. The main features include:
- WebView Support: Incorporates WebView for in-app browsing.
- JavaScript Interface: Allows interaction between JavaScript and WebView.
- Google Play Support: Compatible with Google Play services.
- Payment Provider Integration: Enables integration with various payment providers.
- Mock Data: Provides mock data if Google Pay isn't configured.
The primary library class can be found here: PaymentActivity.java
The Unity project folder structure:
- Editor: Contains post-processors that import dependencies necessary for the library.
- Example: Demonstrates how to use the SDK.
- Plugins: Houses the native Java library.
- Prefabs: Contains product prefabs shown before purchase.
- Resources: Holds a crucial prefab that initializes and activates the SDK automatically.
- Source: Contains the SDK source code.
Key Features of the Source Folder:
-
Initialization: The Command pattern enables asynchronous initialization for simplicity. One line is sufficient:
await Initialization.PaymentSDKInitializationController.InitializeAsync();
The SDK will then be ready for use.
-
PaymentEvents: An Observer class that allows subscription and callback registration from any part of the code for smooth SDK integration.
-
PaymentPopupController: Manages informational popups for products being purchased.
-
BaseProduct: Developers can extend
BaseProductwhile keeping the base API closed, following SOLID principles. -
PaymentSDK: The main SDK class, providing the following:
ShowProductBundle- Displays the product.StartPurchase- Invokes native library purchase methods.- Flask processing from the native library.
To use the SDK, you must install the Google Play Games Plugin for Unity, as it supports Google Pay.