BreezeIAP
This package wraps Unity IAP and provides an interface that is easier for users to work with.
However, receipt validation logic must still be implemented separately.
Quick Start
Section titled “Quick Start”Choose one of the two methods below.
For the version after
#in the GitHub URL, check the latest entry in the changelog.
Use via UPM
Section titled “Use via UPM”- Open UPM and click the
+button in the upper-left corner. - Select
Install package from git URL.... - Enter
https://github.com/achieveonepark/BreezeIAP.git#1.0.0and install it.
Add manually
Section titled “Add manually”- Open
Unity Project/Packages/manifest.json. - Add the following under
dependencies:"com.achieve.iap": "https://github.com/achieveonepark/BreezeIAP.git#1.0.0"
Description
Section titled “Description”This package provides the following features.
BreezeIAP.Initialize | Initialize Unity IAPBreezeIAP.Purchase | Attempt a purchaseBreezeIAP.Confirm | Complete processing after a successful purchaseBreezeIAP.GetPendingList | Get the list of products that have not been completed yetBreezeIAP.GetRestoreList | Get the list of products to restore on Android and iOSInitialize
Section titled “Initialize”The initialization flow of Unity IAP is implemented asynchronously so you can determine when it has completed.
Before initialization, make sure the ProductIds registered in the store can be obtained at runtime.
using Achieve.IAP;
private async void Start(){ // Both Array and List are supported. List<InitializeDto> dtoList = new List<InitializeDto>();
// Register the store product id and product type in a DTO and add it to the list. dtoList.Add(new InitializeDto { ProductId = "Consumable", ProductType = ProductType.Consumable });
await BreezeIAP.InitializeAsync(dtoList);}Purchase, Confirm
Section titled “Purchase, Confirm”The package provides an interface and error messages so the user can clearly determine each stage from purchase attempt to success or failure.
public async void PurchaseAsync(string productId){ PurchaseResult result = await BreezeIAP.PurchaseAsync(productId);
// On success if(result.IsSuccess) { // If you perform receipt validation through a server, add it here.
// Both PurchaseResult and Product are supported. BreezeIAP.Confirm(result);
// Grant the item.
return; }
Debug.Log($"[{result.Product.definition.id}] Failed to purchase the product. Reason: {result.ErrorMessage}");}Dependencies
Section titled “Dependencies”In App Purchasing (4.12.0)