public override void ReceivedResponse(SKProductsRequest request, SKProductsResponse response)
            {
                if (SingleManager.productsRequest == request)
                {
                    SingleManager.productsRequest = null;
                }

                var changed = false;

                foreach (var product in response.Products)
                {
                    ProductDetails details;
                    if (SingleManager.products.TryGetValue(product.ProductIdentifier, out details))
                    {
                        details.SetDetails(product);
                        changed = true;
                    }
                }

                foreach (var product in response.InvalidProducts)
                {
                    ProductDetails details;
                    if (SingleManager.products.TryGetValue(product, out details))
                    {
                        details.SetInvalid();
                        changed = true;
                    }
                }

                // Check that all products have details - if not reload
                SingleManager.RequestProductDetails();

                if (changed)
                {
                    SingleManager.RaiseDetailsChanged();
                }
            }
            public override void UpdatedTransactions(SKPaymentQueue queue, SKPaymentTransaction[] transactions)
            {
                var purchaseChanged = false;

                foreach (var transaction in transactions)
                {
                    switch (transaction.TransactionState)
                    {
                    case SKPaymentTransactionState.Purchased:
                    {
                        ProductDetails details;
                        if (SingleManager.products.TryGetValue(transaction.Payment.ProductIdentifier, out details))
                        {
                            purchaseChanged = true;
                            details.SetPurchased();
                        }

                        SingleManager.PaymentQueue.FinishTransaction(transaction);
                        break;
                    }

                    case SKPaymentTransactionState.Restored:
                    {
                        ProductDetails details;
                        if (SingleManager.products.TryGetValue(transaction.OriginalTransaction.Payment.ProductIdentifier, out details))
                        {
                            purchaseChanged = true;
                            details.SetPurchased();
                        }

                        SingleManager.PaymentQueue.FinishTransaction(transaction);
                        break;
                    }

                    case SKPaymentTransactionState.Failed:
                    {
                        ProductDetails details;
                        if (SingleManager.products.TryGetValue(transaction.Payment.ProductIdentifier, out details))
                        {
                            purchaseChanged = true;
                            details.SetFailed();
                        }

                        if ((SKError)transaction.Error.Code != SKError.PaymentCancelled)
                        {
                            SingleManager.RaiseTransactionFailed(transaction.Error);
                        }

                        SingleManager.PaymentQueue.FinishTransaction(transaction);
                        break;
                    }

                    case SKPaymentTransactionState.Purchasing:
                    {
                        ProductDetails details;
                        if (SingleManager.products.TryGetValue(transaction.Payment.ProductIdentifier, out details))
                        {
                            purchaseChanged = true;
                            details.SetPurchasing();
                        }

                        break;
                    }
                    }
                }

                if (purchaseChanged)
                {
                    SingleManager.RaiseDetailsChanged();
                }
            }