.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,719 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I get the following error after updating my Plugin.InAppBilling NuGet package from version 7.1.3 to 8.0.5.
var resultfin = await billing.FinalizePurchaseAsync(purchase.TransactionIdentifier);
Argument 1: cannot convert from 'string' to 'string[]'
How can I solve this error?
var billing = CrossInAppBilling.Current;
try
{
var connected = await billing.ConnectAsync();
if (connected == true)
{
var purchases = await billing.GetPurchasesAsync(ItemType.InAppPurchase);
int purchaseditems = purchases.Count();
if (purchaseditems > 0)
{
foreach (var purchase in purchases)
{
if (purchase.ProductId != null)
{
if (purchase.State == Plugin.InAppBilling.PurchaseState.Purchased)
{
var resultfin = await billing.FinalizePurchaseAsync(purchase.TransactionIdentifier);
To solve the compilation error:
var resultfin = await billing.FinalizePurchaseAsync( new string[] { purchase.TransactionIdentifier } );
or
var resultfin = await billing.FinalizePurchaseAsync( [purchase.TransactionIdentifier] );
If it is a third-party library, then check the corresponding documentation.