Presented by Max Stottrop

IN-APP PURCHASE
What I will cover today
•   Introduction
•   Proccess of implementing In-App Purchase
•   StoreKit Framework
•   Business & Tips
With In-App Purchase you can…
•   … embed a store directly to your application
•   It uses the Storekit Framework.
In-App Purchase Types

•   Non-Consumable


•   Consumable


•   Auto-renewable subscription


•   Free subscription


•   Non-renewable subscription
Walkthrough




 Create     Fetch     Purchase   Restore
Products   Products   Products   Products
Implementing In-App Purchase



               Setup        Sell
Determine                             Verify     Restore
            Products in   Products
 Product                             Product     previous
              iTunes        with
Offerings                            Receipts   Purchases
             Connect      StoreKit
Products
•   Supported types:
    •   Content
    •   Functionality
    •   Services
    •   Subscriptions
•   Each product has a unique productIdentifier.
•   No real-world goods!
iTunes Connect Setup

•   Setup your Products
•   Create a Test User
    •   One per country
•   Sign out of your Store Settings
    •   Don‘t enter your Test User‘s Ids in the Settings
Store Kit Framework
         Validate In-App Purchase Access


           Retrieving product information


              Show the Store Interface


                Make the purchase


                Process Transaction


              Make the feature avaible


                 Finish Transaction


                 Verify the receipts


            Restore previous Purchases
Validate In-App Purchase Acces

•   Validate In-App Purchase Acces
•   Payment Queue class method canMakePurchase
Determine sellable products

•   Load Product IDs
•   Use SKProductsRequest to determine the sellable subset of the IDs


    NSSet* products = [NSSet setWithObject: @”productID1”, @“productID2“, nil];
    SKProductsRequest *request= [[SKProductsRequest alloc]
    initWithProductIdentifiers: products];
    [productRequest start];


    (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:
    (SKProductsResponse *)response {
                    response.invalidProductsIdentifiers == nonsellable;
                    response.products == sellable;
Show Store
•   UITableView Power?




    (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:
    (SKProductsResponse *)response {
                    for(SKProducts* aProduct in response.products)
                    cell.textLabel.text = aProduct.localizedTitle;
                    cell.textLabel.description = aProduct.localizedDescription;
                    cell.textLabel.extra = aProduct.price;
    }
Request payment

 •   SKPayment Class
     •   Create payment object
     •   Add it to the queue
     •   Observe the payment queue




 SKPayment *payRequest = [SKPayment paymentWithObject:selected];

 [[SKPaymentQueue defaultQueue] addPayment:payRequest];

 - (void)addTransactionObserver:(id <SKPaymentTransactionObserver>) observer
Complete Transaction
  •   updatedTransaction method
      •   SKPaymentTransactionStatePurchased = Succes
      •   SKPaymentTransactionStateRestored = Succes
  •   finishTransaction method



-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray
*)transactions {
   if (atransaction.transactionState == SKPaymentTransactionStatePurchased ) {
          //Unlock content
          [queue finishTransaction:aTransaction]; }
}
Collecting Payments
Feature Delivery

•   Self contained


•   Downloadable
Downloadable Content




             User sends               iPhone
   Fetch                    Apple                  Server     Apple
              payment                  sends
 Products                  returns                verifies    sends
             request to              receipt to
from Apple                receipts                receipt.   product
               Apple                   server
In-App Content



                User purchases
Embed content                      Application
                  content and
   in your                          unlocks
                 Apple verifies
 application.                     functionality.
                   payment.
Remember Product Purchase

  •   Use NSUserDefaults class and preference file
      •   unsecure, easy to „hack“.
      •   saves to Application Support directory
  •   Use Keychain API
      •   Secure
      •   Saved to app Keychain Slice




[[NSUserDefaults standartUserDefaults] setObject:bought forKey:@“boughtItems“];


SecItemAdd ((CFDictionaryRef) boughtItems, NULL);
Verify Product Purchase




   Own          iTunes
                          Validation
  Server        Server
Verify Product Purchase


              Post Base64
  Check                          Server
                 encoded
Transaction                     verifies    App unlocks
               transaction
  receipt                     transaction     content
              to the server
Verify Product Purchase

•   Send JSON object with encoded transaction receipt
    •       {“receipt - data“ : “7b4187e54587ert27e2“}
•   Post to iTunes verification service
    •       http://buy.itunes.apple.com/verifyReceipt
    •       http://sandbox.itunes.apple.com/verifyReceipt
•   Get a JSON object
    •       {“status“ : 0, “receipt“ : { … } }
        •       0 == Succes,
        •       everything else == BAD PIRATES AT WORK
Restore Previous Purchases
•   Free Subscription, Auto-
    Renewing Subscription, Non-
    Consumable items
•   [[SKPaymentQueue
    defaultQueue]
    restoreCompletedTransactions]
•   Subscription & Consumable need
    own mechanism



                                Proccess      „Already
     Customer
                                Succesfull   purchased“
      signs in
                                Payment        Dialog
Business Model

• Which Model to choose?
• What to content sell?
  • Game
  • Everything else

                           Extra Levels
                           Social content
                           In-game Currency
                           Optional Content
                           Money for time/Time
Tips

•   Product Ids are unique across apps!
•   Built Store with sellable products only!
•   Use MBBase64 category from the CocoaDev website
•   Auto-renewing Subscription only for apps with dynamic content.
•   Only show the button when Internet Connection is avaible.
•   To test In-App Purchase you must add the Binary - Reject it!
•   After you added your Products, wait a bit!

• MKStoreKit: Open Source helper.
ONE LAST THING
StoreFront
StoreFront

•   Works via JSON to display Content, Downloads, Updates.
•   Allows to sell free content.
•   No additional server costs/bandwidth.
•   Restoring Auto-renewable Subscriptions - YAY
Q &A
THANKS!
Links

•   Receipt validation: http://bit.ly/zMuTKk, http://bit.ly/we2Pt0 & http://bit.ly/AB09Sv
•   Apple: http://bit.ly/xy7aGV, http://bit.ly/wyLec6 & http://bit.ly/weMm3p
•   MKStoreKit: https://github.com/MugunthKumar/MKStoreKit
•   StoreFront: http://urbanairship.com/docs/inapp_client.html
•   Dr. Touch's Purchase Button: http://bit.ly/zxGjcY

More Related Content

PDF
Get Up-And-Running on Agentforce
PPTX
Flutter festival - Write your first Flutter application
PDF
Foster Employee Engagement and Create a Digital Culture Through Microsoft Mod...
PPTX
Mobile Application Development: Hybrid, Native and Mobile Web Apps
PPTX
Introduction to Mobile Development
PDF
The magic of flutter
PDF
Datacenter migration using vmware
PPTX
Mobile application testing
Get Up-And-Running on Agentforce
Flutter festival - Write your first Flutter application
Foster Employee Engagement and Create a Digital Culture Through Microsoft Mod...
Mobile Application Development: Hybrid, Native and Mobile Web Apps
Introduction to Mobile Development
The magic of flutter
Datacenter migration using vmware
Mobile application testing

What's hot (20)

PPTX
Mobile operating systems
PDF
Cucumber spec - a tool takes your bdd to the next level
PDF
Mobile Application Design & Development
PDF
Top 10 Mobile Application Testing Tools | Edureka
PDF
Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...
PPTX
AWS VS AZURE VS GCP.pptx
PDF
Twilio Product Overview
PDF
The development environment
PPTX
What is Flutter
PPTX
8 Steps to Creating a Mobile App
PPTX
Introduction to PowerApps-1.pptx
PPTX
Android Studio Overview
PDF
Mobile device management ( MDM ) Software Solution
PDF
An introduction to mobile app development and investing
PDF
Modernize Java Apps on Microsoft Azure
PPTX
Qa in CI/CD
PPT
Window Phone
PPTX
Introduction To Cloud Computing
PDF
Azure Application insights - An Introduction
PPTX
Microsoft power platform
Mobile operating systems
Cucumber spec - a tool takes your bdd to the next level
Mobile Application Design & Development
Top 10 Mobile Application Testing Tools | Edureka
Microsoft Azure Overview | Cloud Computing Tutorial with Azure | Azure Traini...
AWS VS AZURE VS GCP.pptx
Twilio Product Overview
The development environment
What is Flutter
8 Steps to Creating a Mobile App
Introduction to PowerApps-1.pptx
Android Studio Overview
Mobile device management ( MDM ) Software Solution
An introduction to mobile app development and investing
Modernize Java Apps on Microsoft Azure
Qa in CI/CD
Window Phone
Introduction To Cloud Computing
Azure Application insights - An Introduction
Microsoft power platform
Ad

Viewers also liked (6)

PDF
TizenLog.pl: In App Purchase
PDF
The Power Of In-App Purchases
PDF
IAP introduce@myBook
PDF
IAP auto renewable in practice
PDF
SwiftyJSON 慘痛經驗
PDF
Newsstand
TizenLog.pl: In App Purchase
The Power Of In-App Purchases
IAP introduce@myBook
IAP auto renewable in practice
SwiftyJSON 慘痛經驗
Newsstand
Ad

Similar to In-App Purchase (20)

PDF
App Store Subscriptions - Condensed Edition
KEY
In App Purchases
PDF
In App Purchase - Transcript.pdf
PPTX
iOS In-App Purchase
PPT
Dodaii Detail English -tokyocamp-
KEY
Android In-App Billing @ Droidcon 2011
KEY
Android in-app billing @ Google DevFest Barcelona 2012
KEY
Android In-App Billing @ Barcelona GTUG
PDF
Android In-app Billing @ Droidcon Murcia
PDF
What's new in iOS 7
PDF
Pricing strategies for iOS applications
PDF
Why and How to Add In-App Purchasing and Subscriptions to your Apps - Mario V...
PDF
20111030i phonedeveloperworkshoppublished
PDF
Complete iOS Toolkit
PPTX
Monetising mobile apps, apppli ltd
PPTX
In-App Purchase API
PDF
In-app purchases for BlackBerry 10
PDF
Mobi: "In-app Payments by Google & Apple"
PDF
Redefining the Digital Retail Space with NFC,Beacons and Apple pay
PDF
Mobile Convention Brussels 2014 - Filip Gossele
App Store Subscriptions - Condensed Edition
In App Purchases
In App Purchase - Transcript.pdf
iOS In-App Purchase
Dodaii Detail English -tokyocamp-
Android In-App Billing @ Droidcon 2011
Android in-app billing @ Google DevFest Barcelona 2012
Android In-App Billing @ Barcelona GTUG
Android In-app Billing @ Droidcon Murcia
What's new in iOS 7
Pricing strategies for iOS applications
Why and How to Add In-App Purchasing and Subscriptions to your Apps - Mario V...
20111030i phonedeveloperworkshoppublished
Complete iOS Toolkit
Monetising mobile apps, apppli ltd
In-App Purchase API
In-app purchases for BlackBerry 10
Mobi: "In-app Payments by Google & Apple"
Redefining the Digital Retail Space with NFC,Beacons and Apple pay
Mobile Convention Brussels 2014 - Filip Gossele

Recently uploaded (20)

PDF
Collective Mining | Corporate Presentation - August 2025
PPTX
4c565f80-7d51-4999-b0ff-25d46823377a.pptx
PDF
Step-by-Step Guide to Buy Aged Facebook Accounts in the USA
PPTX
International relations individual report
PDF
Pointers-in-Writing-a-Draft-of-a-Short-Literary-Piece-1.pdf
PPT
eqr6uwbzqko3uvxbbaue-signature-fe0965ec66a73ae843468725055a13538126d0bb614d80...
PDF
Collective Mining | Corporate Presentation - August 2025
PPTX
opinion fact prediction, value judgement
PDF
Collective Mining | Corporate Presentation - August 2025
PPTX
network revitalization at xime alumini networking
PDF
Collective Mining | Corporate Presentation - August 2025
PPTX
ICT_Strategy_Executive_rrrrrRoadmap.pptx
PDF
Probe Gold Corporate Presentation August 2025 Final.pdf
PPT
275505080-Excitation-System FRWEFAAG.ppt
PPTX
opinion fact prediction, biasness, vested interest
DOC
UND毕业证学历认证,阿德勒大学毕业证存档可查的
PPTX
Individual report of global perspective.
DOCX
748028485-Matatag-Curriculum-Map-English-7-First-Quarter.docx
PDF
Synektik_presentation_Q3_2024 FY_EN final.pdf
PDF
Deutsche EuroShop | Company Presentation | 08/25
Collective Mining | Corporate Presentation - August 2025
4c565f80-7d51-4999-b0ff-25d46823377a.pptx
Step-by-Step Guide to Buy Aged Facebook Accounts in the USA
International relations individual report
Pointers-in-Writing-a-Draft-of-a-Short-Literary-Piece-1.pdf
eqr6uwbzqko3uvxbbaue-signature-fe0965ec66a73ae843468725055a13538126d0bb614d80...
Collective Mining | Corporate Presentation - August 2025
opinion fact prediction, value judgement
Collective Mining | Corporate Presentation - August 2025
network revitalization at xime alumini networking
Collective Mining | Corporate Presentation - August 2025
ICT_Strategy_Executive_rrrrrRoadmap.pptx
Probe Gold Corporate Presentation August 2025 Final.pdf
275505080-Excitation-System FRWEFAAG.ppt
opinion fact prediction, biasness, vested interest
UND毕业证学历认证,阿德勒大学毕业证存档可查的
Individual report of global perspective.
748028485-Matatag-Curriculum-Map-English-7-First-Quarter.docx
Synektik_presentation_Q3_2024 FY_EN final.pdf
Deutsche EuroShop | Company Presentation | 08/25

In-App Purchase

  • 1. Presented by Max Stottrop IN-APP PURCHASE
  • 2. What I will cover today • Introduction • Proccess of implementing In-App Purchase • StoreKit Framework • Business & Tips
  • 3. With In-App Purchase you can… • … embed a store directly to your application • It uses the Storekit Framework.
  • 4. In-App Purchase Types • Non-Consumable • Consumable • Auto-renewable subscription • Free subscription • Non-renewable subscription
  • 5. Walkthrough Create Fetch Purchase Restore Products Products Products Products
  • 6. Implementing In-App Purchase Setup Sell Determine Verify Restore Products in Products Product Product previous iTunes with Offerings Receipts Purchases Connect StoreKit
  • 7. Products • Supported types: • Content • Functionality • Services • Subscriptions • Each product has a unique productIdentifier. • No real-world goods!
  • 8. iTunes Connect Setup • Setup your Products • Create a Test User • One per country • Sign out of your Store Settings • Don‘t enter your Test User‘s Ids in the Settings
  • 9. Store Kit Framework Validate In-App Purchase Access Retrieving product information Show the Store Interface Make the purchase Process Transaction Make the feature avaible Finish Transaction Verify the receipts Restore previous Purchases
  • 10. Validate In-App Purchase Acces • Validate In-App Purchase Acces • Payment Queue class method canMakePurchase
  • 11. Determine sellable products • Load Product IDs • Use SKProductsRequest to determine the sellable subset of the IDs NSSet* products = [NSSet setWithObject: @”productID1”, @“productID2“, nil]; SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers: products]; [productRequest start]; (void)productsRequest:(SKProductsRequest *)request didReceiveResponse: (SKProductsResponse *)response { response.invalidProductsIdentifiers == nonsellable; response.products == sellable;
  • 12. Show Store • UITableView Power? (void)productsRequest:(SKProductsRequest *)request didReceiveResponse: (SKProductsResponse *)response { for(SKProducts* aProduct in response.products) cell.textLabel.text = aProduct.localizedTitle; cell.textLabel.description = aProduct.localizedDescription; cell.textLabel.extra = aProduct.price; }
  • 13. Request payment • SKPayment Class • Create payment object • Add it to the queue • Observe the payment queue SKPayment *payRequest = [SKPayment paymentWithObject:selected]; [[SKPaymentQueue defaultQueue] addPayment:payRequest]; - (void)addTransactionObserver:(id <SKPaymentTransactionObserver>) observer
  • 14. Complete Transaction • updatedTransaction method • SKPaymentTransactionStatePurchased = Succes • SKPaymentTransactionStateRestored = Succes • finishTransaction method -(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { if (atransaction.transactionState == SKPaymentTransactionStatePurchased ) { //Unlock content [queue finishTransaction:aTransaction]; } }
  • 16. Feature Delivery • Self contained • Downloadable
  • 17. Downloadable Content User sends iPhone Fetch Apple Server Apple payment sends Products returns verifies sends request to receipt to from Apple receipts receipt. product Apple server
  • 18. In-App Content User purchases Embed content Application content and in your unlocks Apple verifies application. functionality. payment.
  • 19. Remember Product Purchase • Use NSUserDefaults class and preference file • unsecure, easy to „hack“. • saves to Application Support directory • Use Keychain API • Secure • Saved to app Keychain Slice [[NSUserDefaults standartUserDefaults] setObject:bought forKey:@“boughtItems“]; SecItemAdd ((CFDictionaryRef) boughtItems, NULL);
  • 20. Verify Product Purchase Own iTunes Validation Server Server
  • 21. Verify Product Purchase Post Base64 Check Server encoded Transaction verifies App unlocks transaction receipt transaction content to the server
  • 22. Verify Product Purchase • Send JSON object with encoded transaction receipt • {“receipt - data“ : “7b4187e54587ert27e2“} • Post to iTunes verification service • http://buy.itunes.apple.com/verifyReceipt • http://sandbox.itunes.apple.com/verifyReceipt • Get a JSON object • {“status“ : 0, “receipt“ : { … } } • 0 == Succes, • everything else == BAD PIRATES AT WORK
  • 23. Restore Previous Purchases • Free Subscription, Auto- Renewing Subscription, Non- Consumable items • [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] • Subscription & Consumable need own mechanism Proccess „Already Customer Succesfull purchased“ signs in Payment Dialog
  • 24. Business Model • Which Model to choose? • What to content sell? • Game • Everything else Extra Levels Social content In-game Currency Optional Content Money for time/Time
  • 25. Tips • Product Ids are unique across apps! • Built Store with sellable products only! • Use MBBase64 category from the CocoaDev website • Auto-renewing Subscription only for apps with dynamic content. • Only show the button when Internet Connection is avaible. • To test In-App Purchase you must add the Binary - Reject it! • After you added your Products, wait a bit! • MKStoreKit: Open Source helper.
  • 28. StoreFront • Works via JSON to display Content, Downloads, Updates. • Allows to sell free content. • No additional server costs/bandwidth. • Restoring Auto-renewable Subscriptions - YAY
  • 29. Q &A
  • 31. Links • Receipt validation: http://bit.ly/zMuTKk, http://bit.ly/we2Pt0 & http://bit.ly/AB09Sv • Apple: http://bit.ly/xy7aGV, http://bit.ly/wyLec6 & http://bit.ly/weMm3p • MKStoreKit: https://github.com/MugunthKumar/MKStoreKit • StoreFront: http://urbanairship.com/docs/inapp_client.html • Dr. Touch's Purchase Button: http://bit.ly/zxGjcY

Editor's Notes

  • #2: \n
  • #3: \n
  • #4: \n
  • #5: \n
  • #6: Easy to implement\nNo server cost\nApplication size rises.\nContent cannot be changed or updated\n
  • #7: Get In-App Identifiers\nGet Product Info\nShow the UI\nMake the purchase\nProcess Transaction\nMake the feature avaible\nFinish Transaction\n
  • #8: \n
  • #9: \n
  • #10: Get In-App Identifiers\nGet Product Info\nShow the UI\nMake the purchase\nProcess Transaction\nMake the feature avaible\nFinish Transaction\n
  • #11: \n
  • #12: \n
  • #13: \n
  • #14: \n
  • #15: \n
  • #16: When the payment is added to the payment queue, a persistent transaction is created to hold it. After the payment is processed, the transaction is updated with information about the payment collection. Your application implements an observer that receives messages when transactions are updated. The observer should provide purchased items to the user and then remove the transaction from the payment queue.\nSKPayment\nCollecting payment starts with a payment object. The payment object includes a product identifier and optionally includes the quantity of that product to be purchased. You can queue the same payment object more than once; each time a payment object is queued results in a separate request for payment.\nUsers can disable the ability to make purchases in the Settings application. Before attempting to queue a purchase, your application should first confirm that payment can be processed. You do this by calling the payment queue&amp;#x2019;s canMakePayments method.\nSKPaymentQueue\nThe payment queue is used to communicate with the App Store. When payments are added to the queue, Store Kit transmits the request to the App Store. Store Kit presents dialogs to ask the user to authorize payment. The completed transaction is returned to your application&amp;#x2019;s observer.\nSKPaymentTransaction\nA transaction is created for every payment added to the queue. Each transaction has properties that allow your application to determine the status of the transaction. When payment is collected, the transaction includes additional details about the successful transaction.\nAlthough your application can ask the payment queue for a list of pending transactions, it is more common for an application to wait until the payment queue notifies the payment queue&amp;#x2019;s observer with a list of updated transactions.\nSKPaymentTransactionObserver\nYour application implements the SKPaymentTransactionObserver protocol on an object and adds it as an observer to the payment queue. The observer&amp;#x2019;s primary responsibility is to examine completed transactions, deliver items that were successfully purchased, and remove those transactions from the payment queue.\nYour application should associate an observer with the payment queue when it launches, rather than wait until the user attempts to purchase an item. Transactions are not lost when an application terminates. The next time the application launches, Store Kit resumes processing transactions. Adding the observer during your application&amp;#x2019;s initialization ensures that all transactions are returned to your application.\n
  • #17: \n
  • #18: Dynamic content\nKeep application size under 10mb\nMore secure (out of band receipt verification)\n
  • #19: Easy to implement\nNo server cost\nApplication size rises.\nContent cannot be changed or updated\n
  • #20: NSBundle *bundle = [NSBundle mainBundle];NSDictionary *info = [bundle infoDictionary];if ([info objectForKey: @&quot;SignerIdentity&quot;] != nil){/* do something */}\n
  • #21: \n
  • #22: \n
  • #23: \n
  • #24: \n
  • #25: \n
  • #26: \n
  • #27: \n
  • #28: \n
  • #29: \n
  • #30: \n
  • #31: \n
  • #32: \n