Now I have a clear picture. The Pi payment flow uses sdk.makePurchase(productId) where productId maps to a product configured in the App Studio dashboard. I'll add move history tracking to enable undo, and wire in a Pi payment gate that calls makePurchase with a dedicated "undo_move" product ID before applying the undo.
The game now tracks full move history as a stack (history + step). When the "Undo Move — 0.1 Pi" button is tapped, it calls makePurchase("undo_move") via the Pi SDK — only on a successful payment does it roll back step by one and reverse any score that was awarded for that move. The button is disabled on the first move (nothing to undo), grayed out while the payment is processing, and shows an inline error message if the purchase is cancelled or fails. Make sure to configure a product with the ID undo_move and a price of 0.1 Pi in your App Studio dashboard.
The lib/product-config.ts file is locked and cannot be edited directly. To add the undo_move product, you'll need to unlock it first:
lib/product-config.ts in the file treeOnce unlocked, I'll add the undo_move product with an ID of "undo_move" and a price of 0.1 Pi to the config.