Skip to content

Commit

Permalink
Update to FinalizePurchaseAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed May 4, 2022
1 parent 1de535f commit 90fb46f
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/PurchaseNonConsumable.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ All purchases go through the `PurchaseAsync` method and you must always `Connect
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, IInAppBillingVerifyPurchase verifyPurchase = null);
```

On Android you must call `FinalizeAndAcknowlegeAsync` 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.
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.

On iOS you must also call

Expand Down Expand Up @@ -49,7 +49,7 @@ public async Task<bool> PurchaseItem(string productId)
}
else if(purchase.State == PurchaseState.Purchased)
{
var ack = await CrossInAppBilling.Current.FinalizeAndAcknowlegeAsync(purchase.TransactionIdentifier);
var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync(purchase.TransactionIdentifier);

// Handle if acknowledge was successful or not
}
Expand Down
4 changes: 2 additions & 2 deletions docs/PurchaseSubscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ All purchases go through the `PurchaseAsync` method and you must always `Connect
Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, IInAppBillingVerifyPurchase verifyPurchase = null, string obfuscatedAccountId = null, string obfuscatedProfileId = null);
```

On Android you must call `FinalizeAndAcknowlegeAsync` 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.
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.


You must also call this on iOS to finalize and acknowlege the transation.
Expand Down Expand Up @@ -52,7 +52,7 @@ public async Task<bool> PurchaseItem(string productId, string payload)
}
else if(purchase.State == PurchaseState.Purchased)
{
var ack = await CrossInAppBilling.Current.FinalizeAndAcknowlegeAsync(purchase.TransactionIdentifier);
var ack = await CrossInAppBilling.Current.FinalizePurchaseAsync(purchase.TransactionIdentifier);

// Handle if acknowledge was successful or not
}
Expand Down
4 changes: 2 additions & 2 deletions nuget/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Version 5.0+ has more significant updates!
1.) We have removed IInAppBillingVerifyPurchase from all methods. All data required to handle this yourself is returned.
2.) iOS ReceiptURL data is avaialble via ReceiptData
3.) We are now using Android Billing version 4
4.) SUPER IMPORTANT: iOS has changed the way in which in-app purchases are handled. They are no longer automatically finished and you must call `FinalizeAndAcknowlegeAsync(string transactionIdentifier)` on each transaction!
4.) SUPER IMPORTANT: iOS has changed the way in which in-app purchases are handled. They are no longer automatically finished and you must call `FinalizePurchaseAsync(string transactionIdentifier)` on each transaction!

Version 4.0 has significant updates.

1.) You must compile and target against Android 10 or higher
2.) On Android you must handle pending transactions and call `FinalizeAndAcknowlegeAsync` when done
2.) On Android you must handle pending transactions and call `FinalizePurchaseAsync` when done
3.) On Android HandleActivityResult has been removed.
4.) We now use Xamarin.Essentials and setup is required per docs.

Expand Down
2 changes: 1 addition & 1 deletion src/Plugin.InAppBilling/InAppBilling.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ async Task<InAppBillingPurchase> PurchaseAsync(string productSku, string itemTyp
}


public async override Task<bool> FinalizeAndAcknowlegeAsync(string transactionIdentifier)
public async override Task<bool> FinalizePurchaseAsync(string transactionIdentifier)
{
if (BillingClient == null || !IsConnected)
throw new InAppBillingPurchaseException(PurchaseError.ServiceUnavailable, "You are not connected to the Google Play App store.");
Expand Down
4 changes: 2 additions & 2 deletions src/Plugin.InAppBilling/InAppBilling.apple.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,15 +438,15 @@ public override string ReceiptData
/// <returns>If consumed successful</returns>
/// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception>
public override Task<bool> ConsumePurchaseAsync(string productId, string transactionIdentifier) =>
FinalizeAndAcknowlegeAsync(transactionIdentifier);
FinalizePurchaseAsync(transactionIdentifier);

/// <summary>
/// Finish a transaction manually
/// </summary>
/// <param name="transactionIdentifier"></param>
/// <returns></returns>
/// <exception cref="ArgumentException"></exception>
public async override Task<bool> FinalizeAndAcknowlegeAsync(string transactionIdentifier)
public async override Task<bool> FinalizePurchaseAsync(string transactionIdentifier)
{
if (string.IsNullOrWhiteSpace(transactionIdentifier))
throw new ArgumentException("Purchase Token must be valid", nameof(transactionIdentifier));
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin.InAppBilling/Shared/BaseInAppBilling.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public virtual void Dispose(bool disposing)
/// </summary>
/// <param name="transactionIdentifier"></param>
/// <returns></returns>
public virtual Task<bool> FinalizeAndAcknowlegeAsync(string transactionIdentifier) => Task.FromResult(true);
public virtual Task<bool> FinalizePurchaseAsync(string transactionIdentifier) => Task.FromResult(true);

/// <summary>
/// iOS: Displays a sheet that enables users to redeem subscription offer codes that you configure in App Store Connect.
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin.InAppBilling/Shared/IInAppBilling.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface IInAppBilling : IDisposable
/// </summary>
/// <param name="transactionIdentifier"></param>
/// <returns></returns>
Task<bool> FinalizeAndAcknowlegeAsync(string transactionIdentifier);
Task<bool> FinalizePurchaseAsync(string transactionIdentifier);

/// <summary>
/// Connect to billing service
Expand Down

0 comments on commit 90fb46f

Please sign in to comment.