I have a question about a particular situation with In-App Purchases.
We have a consumable for buying coins in our app:
Problem is, what we supposed to do if the request to our server times out or fails? The user spent the money, but will never get the coins. And if they try to purchase again at that point, it will give them an error saying the purchase hasn't downloaded.
I have seen a "Restore Transactions" option, but not sure how to apply it here. I'd rather not have a button for it somewhere in the app.
Don't worry this app isn't released yet, and this app is written in C# with MonoTouch, but Objective-C answers are welcome.
Restore transactions would do it. It simply redownloads the purchase again. Take a look at the fifth post here:
http://monogame.codeplex.com/discussions/359109
Here is the code to implement it:
InAppPurchaseManager > MySKPaymentObserver:
public override void PaymentQueueRestoreCompletedTransactionsFinished (SKPaymentQueue queue)
{
foreach(SKPaymentTransaction transaction in queue.Transactions)
{
#if DEBUG
Console.WriteLine("Restoring Transaction " + transaction.Payment.ProductIdentifier);
#endif
theManager.restoreTransaction(transaction);
}
}
Here is how to call the code in your game:
app = new InAppPurchaseManager ();
app.LoadStore();
SKPaymentQueue.DefaultQueue.RestoreCompletedTransactions();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With