Group Group Group Group Group Group Group Group Group
raywenderlich.com Forums

In-App Purchase Tutorial: Getting Started

Learn how to grow app revenue in this in-app purchase tutorial by allowing users to purchase or unlock content or features.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5456-in-app-purchase-tutorial-getting-started

There are errors in the RazeFace-Starter’s MasterViewController.swift file, the build fails.

Thank you for the great tutorial.

One question:

It is possible for Non-Consumable products to be automatically added from server side in App Store Connect? Each time when a new product is added on our server, this product to be added automatically.

If I have thousands of items on my server database, do I need manually append each of them?

You must use Xcode 10, and Swift 4.2, as indicated in the note at the beginning of the tutorial.

This tutorial is Good for SandBox Testing, Its Working properly but I want to implement it to my Real Project not Using Sandbox testing, So you please create a tutorial for it and Send me link . if Any Solution apart from it please help me. how to implement in Real App.

@pietrorea Can you please help with this when you get a chance? Thank you - much appreciated! :]

This tutorial does not follow Apple’s recommended best practice, which is to create the payment transaction observer in didFinishLaunchingWithOptions() in the AppDelegate file. This can cause problems in a real world app, as well as making things like redeeming consumable promo codes impossible. Please can you update the tutorial to follow Apple’s recommendation?

Thank you for the tutorial. Easy to folow

Nice tutorial, but what about restoring on app init? Don’t want a restore button, I just want the pre-bought-non-consumable to be there on app init.
Would be nice to see implementation of : Listing 2 in : https://developer.apple.com/library/archive/technotes/tn2387/_index.html

Good tutorial. Thank you

@kumarlav @eatton Could you just move the code from InAppProducts (or at the very least move the store variable to App Delegate) into the app delegate so you can call store = IAPHelper(productIds: InAppProducts.productIdentifiers) in didFinishLaunchingWithOptions() since HAPHelp init() contains SKPaymentQueue.default().add(self) which is what Apple Recommends. ofcause a few other changed had to be changed to work with apple Recommendation like adding SKPaymentTransactionObserver to AppDelegate, removing reference to Observer in IAPHelp since the AppDelegate will manage that & add the Observer via the IAPHelp init() and in App Delegate when adding the paymentQueue(queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) inside that func just put store.paymentQueue(queue, updatedTransactions: transactions) since IAPHelp contains that function already and all your doing is passing the function to the already existing one.

@pietrorea Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi I am running the final tutorial code with all the steps mentioned above. I am getting empty list of products. Is there any chance that this wont work with simulator and will work only with real devices?

@pietrorea Can you please help with this when you get a chance? Thank you - much appreciated! :]

I’ve been having difficulty getting my test device to “see” the In-App products (1 consumable, 1 non-consumable). I have run through the checklist (very helpful) and the only thing I’ve not yet done is wait several hours so I’ll probably check it again in the morning.

One thing that may need to be added to this tutorial is the absolute need to have a Sandbox Tester. Apple informed me today that this was the only way to test in-app purchasing. You may want to make that more explicit in your tutorial - the way I read it, it sounded like I only needed a Sandbox Tester to avoid having to pay for buying something.

You may also want to add code to show what to do when users purchase Apple Hosted Content. This is a great feature - Apple will store purchase-able content for you, so you don’t need to host it yourself. This involves creating an upload package in a separate Xcode project, uploading to Apple, and then showing what the code needs to do when a user purchases it.

How can I dismiss the view after a user had enter password and made a successful IAP?
THanks

@pietrorea Can you please help with this when you get a chance? Thank you - much appreciated! :]

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!