Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 525fd07

Browse files
Merge pull request #634 from jamesmontemagno/dotnet8
.NET 8 update and migration
2 parents 75f0f9e + 403e539 commit 525fd07

File tree

136 files changed

+2430
-32990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+2430
-32990
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*.userprefs
1212

1313
# Build results
14+
.idea/
15+
src/.idea/
1416
[Dd]ebug/
1517
[Dd]ebugPublic/
1618
[Rr]elease/

README.md

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

3-
A simple In-App Purchase plugin for .NET MAUI, Xamarin, and Windows to query item information, purchase items, restore items, and more.
3+
A simple In-App Purchase plugin for .NET MAUI and Windows to query item information, purchase items, restore items, and more.
44

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

77
## Important Version Information
8+
* v8 now supports .NET 8+ .NET MAUI and Windows Apps.
89
* v7 now supports .NET 6+, .NET MAUI, UWP, and Xamarin/Xamarin.Forms projects
910
* v7 is built against Android Billing Library 6.0
1011
* See migration guides below
@@ -19,13 +20,11 @@ Get started by reading through the [In-App Billing Plugin documentation](https:/
1920

2021
|Platform|Version|
2122
| ------------------- | :------------------: |
22-
|Xamarin.iOS & iOS for .NET|10+|
23-
|Xamarin.Mac, macOS for .NET, macCatlyst for .NET |All|
24-
|Xamarin.TVOS, tvOS for .NET|10.13.2|
25-
|Xamarin.Android, Android for .NET|21+|
26-
|Windows 10 UWP|10+|
23+
|iOS for .NET|10+|
24+
|macCatlyst for .NET |All|
25+
|tvOS for .NET|10.13.2|
26+
|Android for .NET|21+|
2727
|Windows App SDK (WinUI 3) |10+|
28-
|Xamarin.Forms|All|
2928
|.NET MAUI|All|
3029

3130
### Created By: [@JamesMontemagno](http://github.com/jamesmontemagno)

docs/CheckAndRestorePurchases.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ When users get a new device or re-install your application it is best practice t
66
/// Get all current purchases for a specified product type.
77
/// </summary>
88
/// <param name="itemType">Type of product</param>
9+
/// <param name="cancellationToken">Cancel the request</param>
910
/// <returns>The current purchases</returns>
10-
Task<IEnumerable<InAppBillingPurchase>> GetPurchasesAsync(ItemType itemType);
11+
Task<IEnumerable<InAppBillingPurchase>> GetPurchasesAsync(ItemType itemType, CancellationToken cancellationToken = default);
1112
```
1213

1314
When you make a call to restore a purchase it will prompt for the user to sign in if they haven't yet, so take that into consideration.

docs/PurchaseConsumable.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ Consumables are unique and work a bit different on each platform and the `Consum
2323
/// <param name="itemType">Type of product being requested</param>
2424
/// <param name="obfuscatedAccountId">Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.</param>
2525
/// <param name="obfuscatedProfileId">Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.</param>
26+
/// <param name="cancellationToken">Cancel the request.</param>
2627
/// <returns>Purchase details</returns>
2728
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
28-
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null);
29+
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null, CancellationToken cancellationToken = default);
2930
```
3031

3132
#### obfuscatedAccountId & obfuscatedProfileId
@@ -44,9 +45,10 @@ Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, st
4445
/// </summary>
4546
/// <param name="productId">Id or Sku of product</param>
4647
/// <param name="transactionIdentifier">Original Purchase Token</param>
48+
/// <param name="cancellationToken">Cancel the request</param>
4749
/// <returns>If consumed successful</returns>
4850
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
49-
Task<InAppBillingPurchase> ConsumePurchaseAsync(string productId, string transactionIdentifier);
51+
Task<InAppBillingPurchase> ConsumePurchaseAsync(string productId, string transactionIdentifier, CancellationToken cancellationToken = default);
5052
```
5153

5254

docs/PurchaseNonConsumable.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ All purchases go through the `PurchaseAsync` method and you must always `Connect
1717
/// <param name="itemType">Type of product being requested</param>
1818
/// <param name="obfuscatedAccountId">Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.</param>
1919
/// <param name="obfuscatedProfileId">Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.</param>
20+
/// <param name="cancellationToken">Cancel the request</param>
2021
/// <returns>Purchase details</returns>
2122
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
22-
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null);
23+
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null, CancellationToken cancellationToken = default);
2324
```
2425

2526
On Android you must call `FinalizePurchaseAsync` within 3 days when a purchase is validated. Please read the [Android documentation on Pending Transactions](https://developer.android.com/google/play/billing/integrate#pending) for more information.
@@ -52,7 +53,7 @@ public async Task<bool> PurchaseItem(string productId)
5253
else if(purchase.State == PurchaseState.Purchased)
5354
{
5455
// only need to finalize if on Android unless you turn off auto finalize on iOS
55-
var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync(purchase.TransactionIdentifier);
56+
var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync([purchase.TransactionIdentifier]);
5657

5758
// Handle if acknowledge was successful or not
5859
}

docs/PurchaseSubscription.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ All purchases go through the `PurchaseAsync` method and you must always `Connect
1717
/// <param name="itemType">Type of product being requested</param>
1818
/// <param name="obfuscatedAccountId">Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.</param>
1919
/// <param name="obfuscatedProfileId">Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.</param>
20+
/// <param name="cancellationToken">Cancel the request.</param>
2021
/// <returns>Purchase details</returns>
2122
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
22-
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null);
23+
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null, CancellationToken cancellationToken = default);
2324
```
2425

2526
On Android you must call `FinalizePurchaseAsync` within 3 days when a purchase is validated. Please read the [Android documentation on Pending Transactions](https://developer.android.com/google/play/billing/integrate#pending) for more information.
@@ -52,7 +53,7 @@ public async Task<bool> PurchaseItem(string productId, string payload)
5253
else if(purchase.State == PurchaseState.Purchased)
5354
{
5455
//only needed on android unless you turn off auto finalize
55-
var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync(purchase.TransactionIdentifier);
56+
var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync([purchase.TransactionIdentifier]);
5657

5758
// Handle if acknowledge was successful or not
5859
}

docs/SecuringPurchases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Each platform handles security of In-App Purchases a bit different. To handle this whenever you make a purchase you should use the date from the purchase to validate on your backend.
44

55
## Recommended Reading:
6-
* [Xamarin.iOS Securing Purchases Documentation](https://developer.xamarin.com/guides/ios/platform_features/in-app_purchasing/transactions_and_verification/#Securing_Purchases)
6+
* [iOS Securing Purchases Documentation](https://developer.xamarin.com/guides/ios/platform_features/in-app_purchasing/transactions_and_verification/#Securing_Purchases)
77
* [Google Play service Security and Design](https://developer.android.com/google/play/billing/billing_best_practices.html)
88

99

nuget/readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
In-App Billing Plugin for .NET MAUI, Xamarin, & Windows
1+
In-App Billing Plugin for .NET MAUI
2+
3+
Version 8.0+ - .NET 8+
4+
1. Updated APIs and you must target .NET 8
25

36
Version 7.0+ - Major Android updates
47
1.) You must compile and target against Android 12 or higher

0 commit comments

Comments
 (0)