jamesmontemagno / InAppBillingPlugin

Cross-platform In App Billing Plugin for .NET
MIT License
651 stars 152 forks source link

Is there a difference between "FinalizePurchaseAsync" and "FinalizePurchaseOfProductAsync"? #582

Closed jonathanfontaine closed 10 months ago

jonathanfontaine commented 10 months ago

I'm using :

Some of my clients are complaining that their purchase has not been finalized/acknowledged :

image (when they hit "confirm", they say nothing happens...)

I'm using the following code to finalize/acknoledge the purchase :

private bool Ack(InAppBillingPurchase purchase)
{
    if (purchase.IsAcknowledged != true)
    {
        var result = CrossInAppBilling.Current.FinalizePurchaseOfProductAsync(purchase.ProductId).Result;
        if (result.Any())
            return result.First().Success;
        else
            return false;
    }
    else
    {
        return true;
    }
}

Is it ok? Or do I need to replace :

var result = CrossInAppBilling.Current.FinalizePurchaseOfProductAsync(purchase.ProductId).Result;

by

var result = CrossInAppBilling.Current.FinalizePurchaseAsync(purchase.TransactionIdentifier).Result;

Is there a difference between those two lines?

jamesmontemagno commented 10 months ago

Yes they are a bit confusing... https://github.com/jamesmontemagno/InAppBillingPlugin/blob/master/src/Plugin.InAppBilling/Shared/IInAppBilling.shared.cs#L35-L47 I will clean this up...

FinalizePurchaseAsync is for iOS/Android when you know your transaction id...

FinalizePurchaseOfProductAsync is ONLY for iOS when you turned off auto finalize.

this is outlined here: https://jamesmontemagno.github.io/InAppBillingPlugin/PurchaseNonConsumable.html

jonathanfontaine commented 10 months ago

Thank you very much @jamesmontemagno !