Adding In-App Purchases to Exported hyperPad Games
You add in-app purchases to an exported hyperPad game in Xcode, after Export. hyperPad doesn't have a purchase Behavior in the iPad editor. Instead, you build the game and its locked and open states in hyperPad, Export it with the paid hyperPad app, and then set up products in App Store Connect. Next you write the purchase code with Apple's StoreKit in the exported Xcode project. Then you test every transaction path and submit the app to Apple.
This is native iOS development. Old tutorials that use a Podfile or a third-party StoreKit wrapper may not match the exported project or Apple's current APIs, so check them before you follow along.
Decide what the purchase gives the player
Define what the player gets before you write any code. Apple supports three main product types:
| Product type | Example | What your game has to handle |
|---|---|---|
| Consumable | A pack of Coins | Deliver it once per purchase, every time |
| Non-consumable | A permanent level pack | Restore access on a new device or after reinstall |
| Subscription | Ongoing access to new content | Check whether access is still active |
Apple explains each type in its In-App Purchase configuration guide.
Build the access rules in hyperPad first
Build the game with both states in hyperPad: the free content and the paid content. Store access in an Attribute, such as levelPackOwned, and use conditions to check it before a paid level opens.
While you test, add a temporary developer button that flips that Attribute. It lets you play both states without any purchase code. Remove the button before your release build.
Export and add StoreKit in Xcode
Once the game works, you need:
- the paid hyperPad app, for Export
- a Mac with Xcode
- an Apple Developer account
- an app record in App Store Connect, with your products set up
Apple's StoreKit 2 APIs load products, process transactions, verify purchases and report what the player currently owns. Your code then needs to tell the game to update the access Attribute you built in hyperPad.
The exact code depends on your exported project and your products. A copied sample won't fit every game. Plan for product IDs, transaction verification, delivering the purchase, restores, interrupted transactions and offline play.
Test the failure paths
Use Xcode's StoreKit testing tools and Apple's sandbox before you submit.
| Test | Expected result |
|---|---|
| Successful purchase | The content opens once |
| Cancelled purchase | Nothing opens, and the game still works |
| Pending transaction | The game waits and doesn't grant access early |
| Reinstall or new device | Restorable purchases come back |
| Network drop | The game stays in a safe, clear state |
Never show a purchase button that doesn't work. If a product fails to load, hide or disable the button and keep the free game playable.
Submit to Apple
The hyperPad Xcode submission guide covers archiving and uploading. Check Apple's In-App Purchase documentation and App Review Guidelines while you build, because the rules change.
To compare in-app purchases with paid downloads and ads, read how to monetize your game.
Your next step
Open your Project and add one access Attribute for the content you plan to sell. Build both states and test them with a developer button. Once both feel right, you're ready to Export and start the StoreKit work.
