Skip to content

Commit 845ca11

Browse files
Merge pull request #677 from jamesmontemagno/androidv7billing
Update to v8
2 parents 2485d84 + 93a86c5 commit 845ca11

File tree

6 files changed

+25
-58
lines changed

6 files changed

+25
-58
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
## In-App Billing Plugin for .NET MAUI and Windows
22

3+
> Important Note: I do not plan on continuing support for this library. As noted in April of 2025: In App Purchase APIs have always been extremely complex, hard to manage, hard to update, and hard to streamline into a single API. I have enjoyed working and evolving this project over the years, but with StoreKit being deprecated for StoreKit2 and the ever-evolving Android Billing Library that always has massive changes, I simply do not have the time and energy to keep the library up to date. I appreciate everyone that has contributed over and used the library over the years. I encourage forking and evolving the library and of course you can just pull the source code into your project directly.
4+
35
A simple In-App Purchase plugin for .NET MAUI and Windows to query item information, purchase items, restore items, and more.
46

57
Subscriptions are supported on iOS, Android, and Mac. Windows/UWP/WinUI 3 - does not support subscriptions at this time.
68

79
## Important Version Information
10+
* v10 now supports .NET 10+ and Android Billing v8
811
* v9 now supports .NET 9+ and Android Billing v7
912
* v8 now supports .NET 8+ .NET MAUI and Windows Apps.
1013
* v7 now supports .NET 6+, .NET MAUI, UWP, and Xamarin/Xamarin.Forms projects
@@ -23,7 +26,6 @@ Get started by reading through the [In-App Billing Plugin documentation](https:/
2326
| ------------------- | :------------------: |
2427
|iOS for .NET|10+|
2528
|macCatlyst for .NET |All|
26-
|tvOS for .NET|10.13.2|
2729
|Android for .NET|21+|
2830
|Windows App SDK (WinUI 3) |10+|
2931
|.NET MAUI|All|

nuget/readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
In-App Billing Plugin for .NET MAUI
22

3+
> Important Note: I do not plan on continuing support for this library. As noted in April of 2025: In App Purchase APIs have always been extremely complex, hard to manage, hard to update, and hard to streamline into a single API. I have enjoyed working and evolving this project over the years, but with StoreKit being deprecated for StoreKit2 and the ever-evolving Android Billing Library that always has massive changes, I simply do not have the time and energy to keep the library up to date. I appreciate everyone that has contributed over and used the library over the years. I encourage forking and evolving the library and of course you can just pull the source code into your project directly.
4+
5+
* v10 now supports .NET 10+ and Android Billing v8
6+
37
Version 9.0+ - .NET 9+
48
1. Built against Android Billing v7
59

src/Plugin.InAppBilling/InAppBilling.android.cs

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ public async override Task<IEnumerable<InAppBillingProduct>> GetProductInfoAsync
181181
var skuDetailsParams = QueryProductDetailsParams.NewBuilder().SetProductList(productList);
182182

183183
var skuDetailsResult = await BillingClient.QueryProductDetailsAsync(skuDetailsParams.Build());
184-
ParseBillingResult(skuDetailsResult?.Result, IgnoreInvalidProducts);
184+
//ParseBillingResult(skuDetailsResult?.ProductDetailsList, IgnoreInvalidProducts);
185185

186-
return skuDetailsResult.ProductDetails.Select(product => product.ToIAPProduct());
186+
return skuDetailsResult.ProductDetailsList.Select(product => product.ToIAPProduct());
187187
}
188188

189189

@@ -207,30 +207,7 @@ public override async Task<IEnumerable<InAppBillingPurchase>> GetPurchasesAsync(
207207
return purchasesResult.Purchases.Select(p => p.ToIABPurchase());
208208
}
209209

210-
/// <summary>
211-
/// Android only: Returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed.
212-
/// </summary>
213-
/// <param name="itemType">Type of product</param>
214-
/// <returns>The current purchases</returns>
215-
public override async Task<IEnumerable<InAppBillingPurchase>> GetPurchasesHistoryAsync(ItemType itemType, CancellationToken cancellationToken)
216-
{
217-
if (BillingClient == null)
218-
throw new InAppBillingPurchaseException(PurchaseError.ServiceUnavailable, "You are not connected to the Google Play App store.");
219-
220-
var skuType = itemType switch
221-
{
222-
ItemType.InAppPurchase => ProductType.Inapp,
223-
ItemType.InAppPurchaseConsumable => ProductType.Inapp,
224-
_ => ProductType.Subs
225-
};
226-
227-
var historyParams = QueryPurchaseHistoryParams.NewBuilder().SetProductType(skuType).Build();
228-
//TODO: Binding needs updated
229-
var purchasesResult = await BillingClient.QueryPurchaseHistoryAsync(historyParams);
230-
231-
232-
return purchasesResult?.PurchaseHistoryRecords?.Select(p => p.ToIABPurchase()) ?? new List<InAppBillingPurchase>();
233-
}
210+
234211

235212
/// <summary>
236213
/// (Android specific) Upgrade/Downgrade/Change a previously purchased subscription
@@ -264,9 +241,9 @@ async Task<InAppBillingPurchase> UpgradePurchasedSubscriptionInternalAsync(strin
264241

265242
var skuDetailsResult = await BillingClient.QueryProductDetailsAsync(skuDetailsParams);
266243

267-
ParseBillingResult(skuDetailsResult.Result);
244+
//ParseBillingResult(skuDetailsResult.Result);
268245

269-
var skuDetails = skuDetailsResult.ProductDetails.FirstOrDefault() ?? throw new ArgumentException($"{newProductId} does not exist");
246+
var skuDetails = skuDetailsResult.ProductDetailsList.FirstOrDefault() ?? throw new ArgumentException($"{newProductId} does not exist");
270247

271248
//1 - BillingFlowParams.ProrationMode.ImmediateWithTimeProration
272249
//2 - BillingFlowParams.ProrationMode.ImmediateAndChargeProratedPrice
@@ -368,10 +345,10 @@ async Task<InAppBillingPurchase> PurchaseAsync(string productSku, string itemTyp
368345

369346
var skuDetailsResult = await BillingClient.QueryProductDetailsAsync(skuDetailsParams.Build());
370347

371-
ParseBillingResult(skuDetailsResult.Result);
348+
//ParseBillingResult(skuDetailsResult.Result);
372349

373350

374-
var skuDetails = skuDetailsResult.ProductDetails.FirstOrDefault() ?? throw new ArgumentException($"{productSku} does not exist");
351+
var skuDetails = skuDetailsResult.ProductDetailsList.FirstOrDefault() ?? throw new ArgumentException($"{productSku} does not exist");
375352
BillingFlowParams.ProductDetailsParams productDetailsParamsList;
376353

377354
if (itemType == ProductType.Subs)

src/Plugin.InAppBilling/Plugin.InAppBilling.csproj

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net9.0-android;net9.0-ios;net9.0-maccatalyst;net9.0-macos</TargetFrameworks>
4-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
3+
<TargetFrameworks>net10.0;net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0-macos</TargetFrameworks>
4+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<SingleProject>true</SingleProject>
77
<AssemblyName>Plugin.InAppBilling</AssemblyName>
88
<RootNamespace>Plugin.InAppBilling</RootNamespace>
99
<Product>$(AssemblyName) ($(TargetFramework))</Product>
10-
<AssemblyVersion>9.0.0.0</AssemblyVersion>
11-
<AssemblyFileVersion>9.0.0.0</AssemblyFileVersion>
12-
<Version>9.0.0.0</Version>
10+
<AssemblyVersion>10.0.0.0</AssemblyVersion>
11+
<AssemblyFileVersion>10.0.0.0</AssemblyFileVersion>
12+
<Version>10.0.0.0</Version>
1313
<Authors>James Montemagno</Authors>
1414
<IsPackable>True</IsPackable>
1515
<PackageId>Plugin.InAppBilling</PackageId>
@@ -29,7 +29,7 @@
2929
.NET MAUI and Windows Plugin to In-App Billing. Get item information, purchase items, and restore purchases with a cross-platform API.
3030
Read the full documenation on the projects page.
3131
</Description>
32-
<Copyright>Copyright 2024</Copyright>
32+
<Copyright>Copyright 2025</Copyright>
3333
<RepositoryUrl>https://github.com/jamesmontemagno/InAppBillingPlugin</RepositoryUrl>
3434
<PackageReleaseNotes>See: https://github.com/jamesmontemagno/InAppBillingPlugin</PackageReleaseNotes>
3535
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -93,15 +93,15 @@
9393
<!-- Android -->
9494

9595
<ItemGroup Condition=" $(TargetFramework.Contains('-android')) ">
96-
<PackageReference Include="Xamarin.Android.Google.BillingClient" Version="7.1.1.4" />
97-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core">
98-
<Version>2.8.7.4</Version>
96+
<PackageReference Include="Xamarin.Android.Google.BillingClient" Version="8.1.0" />
97+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core">
98+
<Version>2.9.3</Version>
9999
</PackageReference>
100100
</ItemGroup>
101101

102102

103-
<ItemGroup Condition=" $(TargetFramework.Contains('net9.0-android')) ">
104-
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.81" />
103+
<ItemGroup Condition=" $(TargetFramework.Contains('net10.0-android')) ">
104+
<PackageReference Include="Microsoft.Maui.Essentials" Version="10.0.11" />
105105
</ItemGroup>
106106

107107

src/Plugin.InAppBilling/Shared/BaseInAppBilling.shared.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,6 @@ public abstract class BaseInAppBilling : IInAppBilling, IDisposable
7373
public abstract Task<IEnumerable<InAppBillingPurchase>> GetPurchasesAsync(ItemType itemType, CancellationToken cancellationToken = default);
7474

7575

76-
77-
/// <summary>
78-
/// Android only: Returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed.
79-
/// </summary>
80-
/// <param name="itemType">Type of product</param>
81-
/// <returns>The current purchases</returns>
82-
public virtual Task<IEnumerable<InAppBillingPurchase>> GetPurchasesHistoryAsync(ItemType itemType, CancellationToken cancellationToken = default) =>
83-
Task.FromResult<IEnumerable<InAppBillingPurchase>>(new List<InAppBillingPurchase>());
84-
8576
/// <summary>
8677
/// Purchase a specific product or subscription
8778
/// </summary>

src/Plugin.InAppBilling/Shared/IInAppBilling.shared.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ public interface IInAppBilling : IDisposable
7676
Task<IEnumerable<InAppBillingPurchase>> GetPurchasesAsync(ItemType itemType, CancellationToken cancellationToken = default);
7777

7878

79-
/// <summary>
80-
/// Android only: Returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed.
81-
/// </summary>
82-
/// <param name="itemType">Type of product</param>
83-
/// <returns>The current purchases</returns>
84-
Task<IEnumerable<InAppBillingPurchase>> GetPurchasesHistoryAsync(ItemType itemType, CancellationToken cancellationToken = default);
85-
8679
/// <summary>
8780
/// Purchase a specific product or subscription
8881
/// </summary>

0 commit comments

Comments
 (0)