public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
{
try
{
// Reward user package
}
catch (Exception e)
{
Debug.Log("Error: " + e.ToString());
}
return (PurchaseProcessingResult.Complete); // Shouldn't this be something different if it fails?
}
We’re havinga problem atm where there’s an exception thrown and user doesnt get their reward/package content but they’re still charged for it.
My question is, how do I NOT charge them if an exception was thrown? The only other enum type for PurchaseProcessingResult is Pending, should I return that instead?
[Edit] I’m not even sure I could do anything at this point in ProcessPurchase if this gets called AFTER the user pays and the transaction is complete. I guess there’s no way to cancel it then?
You should only return Pending if you want to be reminded of the purchase. The most common use case is if you are saving your purchases to a server. In that case, you would return Pending, then confirm the purchase on your server, then, outside of ProcessPurchase, you would call ConfirmPendingPurchase. Otherwise, the IAP system would call ProcessPurchase for the same purchase again after the app restarts.
Your edit is correct. You can see in the diagram in the Manual that ProcessPurchase is called after the user has been charged: