API 4 IAP PIA: SwiftyStoreKit Seriously Simplifies Subscriptions
API 4 IAP PIA: SwiftyStoreKit Seriously Simplifies Subscriptions
A lot of problems come along with IAP subscriptions. See how SwiftyStoreKit can help with best practices for implementing your StoreKit support for IAP.
Join the DZone community and get the full member experience.Join For Free
There's been quite a bit of angst and snark recently about what a pain in the fundament it is dealing with IAP subscriptions, you may have noticed:Testing In-App Purchases Ruins Your Phone
Getting in-app purchases right is a goal that every app developer should have. Your customer's experience when handing over their money should be seamless. To guarantee a good experience you must rigorously test. However, there are many pain points involved in doing this. Each individual issue is only irritating, but together they create enough friction that properly testing in-app purchases is a miserable experience...
My personal least favorite when working with recurring subscriptions: If you make a test purchase of a recurring subscription, you will be forever presented with a looping App Store login modal, usually when unlocking your phone. This renders any personal device you are testing on ruined...
This is a common problem ... which some people give short shrift:
My thoughts on the trending iOS subscriptions loop login complaints: read the documentation carefully and follow @Apple best practices. You'll never encounter this problem.
Well ... they're not quite as clear as all that, really. Here is an excellent guide to the travails you'll face:Testing Auto-Renewable Subscriptions on iOS
Subscriptions work differently in TestFlight, the sandbox, and live on the App Store, so testing them requires knowledge of those differences. This is my attempt to help sort out the mess and document it for others to reference...
You definitely want to Read The Whole Thing™ on this one, but we'll highlight this hack we did not know for testing live subscriptions on the App Store before release! No, really, you can do that:
For an app that has yet to be released on the App Store, getting an early version of the app approved is a great way to test subscriptions:
1. Submit a beta version of the app to App Review. Make sure to set "Version Release" to "Manually release this version" so that the app is not released on the App Store.
2. Generate promo codes for the app. This can be done for free apps that are approved, but not yet on the App Store.
3. Download the app from the App Store using a promo code.
Since this app has gone through approval, subscriptions will perform exactly as they will when the app is live on the App Store, including charging testers who subscribe and allowing testers to manage the subscription in the App Store app. Promo codes can be given to testers so that they can test the app for free. Subscriptions paid for via promo code work exactly like paid subscriptions, except that they don't auto-renew...
Definitely want to make sure you do that. Surprises with your monetization are the worst kind of surprise, amirite?
Now, on the programming side, we feel there's a clear best practice currently for implementing your StoreKit support in general, but particularly for subscriptions:
SwiftyStoreKit: "Lightweight In App Purchases Swift framework for iOS 8.0+, tvOS 9.0+ and macOS 10.10+"
Super easy to use block based API
Support for consumable, non-consumable in-app purchases
Support for free, auto renewable and non renewing subscriptions
iOS, tvOS and macOS compatible
It's been actively maintained up to 2 days ago as we write this, with 2733 stars on Github and 26,536 installs on CocoaPods.org - it's healthy to be leery of introducing third-party dependencies to essential parts of your app flow, but this one is downright mainstream at this point. And it comes with a complete background education:
Apple - WWDC16, Session 702: Using Store Kit for In-app Purchases with Swift 3
Apple - TN2387: In-App Purchase Best Practices
Apple - TN2413: In-App Purchase FAQ (also see Cannot connect to iTunes Store)
Apple - TN2259: Adding In-App Purchase to Your Applications
iTunes Connect Developer Help - Workflow for configuring in-app purchases
Apple - About Receipt Validation
Apple - Receipt Validation Programming Guide
Apple - Validating Receipts Locally
Apple - Working with Subscriptions
Apple - Offering Subscriptions
Apple - Restoring Purchased Products
Apple - Testing In-App Purchase Products: includes info on duration of subscriptions in sandbox mode
objc.io - Receipt Validation
I have also written about building SwiftyStoreKit on Medium:
How I got 1000 ⭐️ on my GitHub Project
Maintaining a Growing Open Source Project
So there you go, that should be all the resources you need for as painless an IAP implementation as possible!
And while we're talking about IAP, there is a most excellent article here on design, psychology, and strategy:The Ultimate Guide To Mobile In-App Purchases Optimization
Now you can't just create in-app purchases in your app haphazardly and let it run itself. It's a long process that requires blood, sweet, and tears. You need to optimize your in-app purchases to make sure that you're getting the most that you can out of them.
There are many different models, techniques, and strategies that the top-grossing apps and industry leaders use to optimize their in-app purchases and increase their revenue and we'll be discussing all of the main and most popular ones...
There's not much here that will be completely new to you, especially if you play those pay-to-win games that have taken over the App Store these days; but it's nice to have a concise compendium of best practices that's up to date with iOS 11's App Store IAP promotions to refer to. Our fave tip:
If your mobile app or game becomes big and popular enough, you can use that to offer real-life merchandise through your app. This had been the case with hit mobile games like Halfbrick's Fruit Ninja and Jetpack Joyride that sell t-shirts and mugs through their games and Rovio's Angry Birds that sells t-shirts, hats, toys, LEGO sets, backpacks, and more, and even went on to make an animated series and a full feature movie...
That's an interesting idea actually; if you have all this game art, why not make swag out of it? We do every so often get asked if we have shirts with the Trollsheep on them ... maybe we'll look into that. Especially now that we live in Southeast Asia and all where swag production is a thing!
Published at DZone with permission of Alex Curylo , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.