Search code examples
iosin-app-purchaseapp-store-connectin-app-billingin-app-subscription

iOS: How to create In-App Purchases programmatically


I am creating a multi platform e-learning app, where teachers create courses by uploading videos to my website. Students can purchase these courses via the website, iOS, and Android.

However, since digital content for mobile can only be purchased through the App Store and Play Store, I have to programmatically create a new In-App Purchase item for every new course that a teacher uploads. Google has a REST API that lets me do this without hassle but I have not found a solution to do this for Apple.

I have gone through all of Apple's documentation regarding In-App Purchases

here: https://help.apple.com/app-store-connect/#/devae49fb316

here: https://help.apple.com/asc/appsspec/#/itcbce96a8e7

here: https://developer.apple.com/documentation/appstoreconnectapi/apps

and here: https://help.apple.com/itc/transporteruserguide/en.lproj/static.html

I have also scoured the forums and no luck there either. I don't understand. What am I missing? How do other platforms like Udemy do this?

Any help or insights would be greatly appreciated.


Solution

  • This is not really a solution but a workaround. Apple has pre-defined price tiers for In-App purchases. In other words, you can't just type in any price when creating a digital product, you have to select a price from a list given by Apple. My workaround was manually creating about 20 in-app purchase products, each with a different price tier. Then force the teachers to choose from one of these price tiers when they upload a course. When a student makes a purchase, the app will already know which product is in which price tier and process the payment accordingly.