Identifying Initial Purchase vs Automated Retry vs Restore (iOS & Android)

Hi team,

For contextual messaging and other internal handling, I need to discern (on both Android and iOS) between an initial purchase, a previous failed purchase being automatically retried and a restore.

One of my key use cases which I cannot find documented anywhere is that when I have a product ID that combines payouts of both Non-consumable and consumable items, I don’t want to reprocess the consumable portion and so I need to be able to identify a restore attempt.

I would love any tips and ideas. Here is where my current exploration has arrived.

IOS:
I can add a flag at InitiatePurchase() to be read at ProcessPurchase() to identify an initial purchase.

I can read the appleProductIsRestored flag to determine a restore or could possibly add a flag when “Restore purchases” is clicked (and some sort of counter to know when processing had finished) to unflag it.

I can determine a retry from neither of the above flags being true when a Process request is made or possibly store failed transactionIDs (but local storage won’t work on multiple-device installs).

ANDROID:

I can flag an initial purchase as above for IOS.
I am struggling to discern a retry vs a restore for Android because both are automatically triggered and there is no flag in the receipt like for Apple… HELP!! :slight_smile:

BONUS ISSUE…

I read that storing Transaaction IDs on the server is useful to protect against fraud where people reuse a receipt but unless that ID is attached to an App Store Account, how would you discern fraud from a restore attempt if you can’t identify the restore attempt itself?

If you can spare a few moments to help or even link to best practices and helpful IAP info I would greatly appreciate it.

Thanks.

1 Like