Spielerando

Fix "restore purchases" that gives coins again or forgets what was bought

After a reinstall, the store sends a list of old purchases. Treat it carelessly and a bag of coins is paid again, or something the player really owns is lost, or a refunded item stays unlocked. This entry shows how to make the AI treat each kind of purchase by its own rule.

Why this works

What the player bought is a fact in the store, not in your game. A lasting unlock is a state to be matched against that fact. A bag of coins is a one-time event, so the question is whether this particular receipt was paid out already.

When not to use it

Replaying receipts on the device is only as safe as the device. Anyone can fake a receipt there. If real money or a shared ranking depends on it, let a server confirm each receipt with the store before anything is unlocked or paid.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • A diagram of every state
  • 34 lines of example code with 5 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Fix "restore purchases" that gives coins again or forgets what was bought" (read_entry restore-purchases-duplicates-or-loses) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP