Skip to content

Commit

Permalink
Update docs (I think - these looked out of date)
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed May 24, 2024
1 parent 0ed206f commit c27cebc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion docs/CheckAndRestorePurchases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
/// <param name="itemType">Type of product</param>
/// <param name="cancellationToken">Cancel the request</param>
/// <returns>The current purchases</returns>
Task<IEnumerable<InAppBillingPurchase>> GetPurchasesAsync(ItemType itemType);
Task<IEnumerable<InAppBillingPurchase>> 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.
Expand Down
6 changes: 4 additions & 2 deletions docs/PurchaseConsumable.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ Consumables are unique and work a bit different on each platform and the `Consum
/// <param name="itemType">Type of product being requested</param>
/// <param name="obfuscatedAccountId">Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.</param>
/// <param name="obfuscatedProfileId">Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.</param>
/// <param name="cancellationToken">Cancel the request.</param>
/// <returns>Purchase details</returns>
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null);
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null, CancellationToken cancellationToken = default);
```

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


Expand Down
5 changes: 3 additions & 2 deletions docs/PurchaseNonConsumable.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ All purchases go through the `PurchaseAsync` method and you must always `Connect
/// <param name="itemType">Type of product being requested</param>
/// <param name="obfuscatedAccountId">Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.</param>
/// <param name="obfuscatedProfileId">Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.</param>
/// <param name="cancellationToken">Cancel the request</param>
/// <returns>Purchase details</returns>
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null);
Task<InAppBillingPurchase> 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.
Expand Down Expand Up @@ -52,7 +53,7 @@ public async Task<bool> 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
}
Expand Down
5 changes: 3 additions & 2 deletions docs/PurchaseSubscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ All purchases go through the `PurchaseAsync` method and you must always `Connect
/// <param name="itemType">Type of product being requested</param>
/// <param name="obfuscatedAccountId">Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.</param>
/// <param name="obfuscatedProfileId">Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.</param>
/// <param name="cancellationToken">Cancel the request.</param>
/// <returns>Purchase details</returns>
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null);
Task<InAppBillingPurchase> 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.
Expand Down Expand Up @@ -52,7 +53,7 @@ public async Task<bool> 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
}
Expand Down
2 changes: 1 addition & 1 deletion docs/SecuringPurchases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit c27cebc

Please sign in to comment.