From c27cebc5fe15a8b06ccdc08c8bce29c8e7268d33 Mon Sep 17 00:00:00 2001 From: Allan Ritchie Date: Thu, 23 May 2024 21:55:24 -0400 Subject: [PATCH] Update docs (I think - these looked out of date) --- docs/CheckAndRestorePurchases.md | 3 ++- docs/PurchaseConsumable.md | 6 ++++-- docs/PurchaseNonConsumable.md | 5 +++-- docs/PurchaseSubscription.md | 5 +++-- docs/SecuringPurchases.md | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/CheckAndRestorePurchases.md b/docs/CheckAndRestorePurchases.md index ad20ec3..c1217fb 100644 --- a/docs/CheckAndRestorePurchases.md +++ b/docs/CheckAndRestorePurchases.md @@ -6,8 +6,9 @@ When users get a new device or re-install your application it is best practice t /// Get all current purchases for a specified product type. /// /// Type of product +/// Cancel the request /// The current purchases -Task> GetPurchasesAsync(ItemType itemType); +Task> GetPurchasesAsync(ItemType itemType, CancellationToken cancellationToken = default); ``` 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. diff --git a/docs/PurchaseConsumable.md b/docs/PurchaseConsumable.md index 7bbf337..69fc96b 100644 --- a/docs/PurchaseConsumable.md +++ b/docs/PurchaseConsumable.md @@ -23,9 +23,10 @@ Consumables are unique and work a bit different on each platform and the `Consum /// Type of product being requested /// Specifies an optional obfuscated string that is uniquely associated with the user's account in your app. /// Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app. +/// Cancel the request. /// Purchase details /// If an error occurs during processing -Task PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null); +Task PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null, CancellationToken cancellationToken = default); ``` #### obfuscatedAccountId & obfuscatedProfileId @@ -44,9 +45,10 @@ Task PurchaseAsync(string productId, ItemType itemType, st /// /// Id or Sku of product /// Original Purchase Token +/// Cancel the request /// If consumed successful /// If an error occurs during processing -Task ConsumePurchaseAsync(string productId, string transactionIdentifier); +Task ConsumePurchaseAsync(string productId, string transactionIdentifier, CancellationToken cancellationToken = default); ``` diff --git a/docs/PurchaseNonConsumable.md b/docs/PurchaseNonConsumable.md index e190880..56086a7 100644 --- a/docs/PurchaseNonConsumable.md +++ b/docs/PurchaseNonConsumable.md @@ -17,9 +17,10 @@ All purchases go through the `PurchaseAsync` method and you must always `Connect /// Type of product being requested /// Specifies an optional obfuscated string that is uniquely associated with the user's account in your app. /// Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app. +/// Cancel the request /// Purchase details /// If an error occurs during processing -Task PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null); +Task PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null, CancellationToken cancellationToken = default); ``` 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 PurchaseItem(string productId) else if(purchase.State == PurchaseState.Purchased) { // only need to finalize if on Android unless you turn off auto finalize on iOS - var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync(purchase.TransactionIdentifier); + var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync([purchase.TransactionIdentifier]); // Handle if acknowledge was successful or not } diff --git a/docs/PurchaseSubscription.md b/docs/PurchaseSubscription.md index d613685..443e569 100644 --- a/docs/PurchaseSubscription.md +++ b/docs/PurchaseSubscription.md @@ -17,9 +17,10 @@ All purchases go through the `PurchaseAsync` method and you must always `Connect /// Type of product being requested /// Specifies an optional obfuscated string that is uniquely associated with the user's account in your app. /// Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app. +/// Cancel the request. /// Purchase details /// If an error occurs during processing -Task PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null); +Task PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null, CancellationToken cancellationToken = default); ``` 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 PurchaseItem(string productId, string payload) else if(purchase.State == PurchaseState.Purchased) { //only needed on android unless you turn off auto finalize - var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync(purchase.TransactionIdentifier); + var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync([purchase.TransactionIdentifier]); // Handle if acknowledge was successful or not } diff --git a/docs/SecuringPurchases.md b/docs/SecuringPurchases.md index 2a67d93..c739d9e 100644 --- a/docs/SecuringPurchases.md +++ b/docs/SecuringPurchases.md @@ -3,7 +3,7 @@ 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. ## Recommended Reading: -* [Xamarin.iOS Securing Purchases Documentation](https://developer.xamarin.com/guides/ios/platform_features/in-app_purchasing/transactions_and_verification/#Securing_Purchases) +* [iOS Securing Purchases Documentation](https://developer.xamarin.com/guides/ios/platform_features/in-app_purchasing/transactions_and_verification/#Securing_Purchases) * [Google Play service Security and Design](https://developer.android.com/google/play/billing/billing_best_practices.html)