public void RequestFailed(SKRequest request, NSError error) { // Get Info for the Exception string description = error.LocalizedDescription ?? string.Empty; PurchaseError purchaseError = error.ToPurchaseError(); // Failed to Restore. Set the Exception to the Task, so the caller can react to the issue _productsReceived.TrySetException(new InAppPurchaseException(purchaseError, description)); }
public override void RestoreCompletedTransactionsFailedWithError(SKPaymentQueue queue, NSError error) { Debug.WriteLine($"RestoreCompletedTransactionsFailedWithError called... _transactionsRestored is null = {_transactionsRestored==null}"); try { // Get Info for the Exception string description = error?.LocalizedDescription ?? string.Empty; PurchaseError purchaseError = error.ToPurchaseError(); // Failed to Restore. Set the Exception to the Task, so the caller can react to the issue _transactionsRestored?.TrySetException(new InAppPurchaseException(purchaseError, description)); _transactionsRestored = null; } catch (Exception ex) { Debug.WriteLine($"Exception {ex.ToString()}"); _transactionsRestored?.TrySetException(new InAppPurchaseException(PurchaseError.Unknown, ex.ToString())); _transactionsRestored = null; } }