1 / 15

In-app Purchasing

In-app Purchasing. 07/10/2012 North Atlanta iOS Developers Meetup Group. Apple Documentation. Apple Documentation is available at: http://developer.apple.com/library/ios/# DOCUMENTATION/NetworkingInternet/Conceptual/StoreKitGuide/Introduction/Introduction.html

ivrit
Download Presentation

In-app Purchasing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. In-app Purchasing 07/10/2012 North Atlanta iOS Developers Meetup Group

  2. Apple Documentation Apple Documentation is available at: http://developer.apple.com/library/ios/#DOCUMENTATION/NetworkingInternet/Conceptual/StoreKitGuide/Introduction/Introduction.html The iOS Framework required to implement in-app purchases is the Store Kit framework

  3. Products A “product” is any feature that you want to sell within your app. It can be: Content, Functionality, Services, Subscriptions. Products are defined within the iTunes Connect (for your application)

  4. Important Guidelines You must deliver a digital good or service within your application (ie. real-world goods/services are not allowed) Items cannot represent intermediary currency Items cannot contain/relate to pornography, hate speech, defamation, gambling (except simulated gambling), or anything that Apple finds objectionable. (Yes, in-app purchase items have to be approved by Apple)

  5. Product types Consumable Non-consumable Auto-renewable subscriptions Free subscriptions (only for Newsstand apps) Non-renewing subscriptions For details/requirements on subscription types refer to Apple docs. Certain subscription types require that the content be provided to all devices associated with user’s Apple ID

  6. Built-in Feature Delivery Model Everything needed to provide feature is already bundled/built into the app. This works well for unlocking functionality, or delivering content already within bundle. Generally, the in-app purchase type should be non-consumable

  7. Server Delivery Model Built-in model has several limitations (ie. to add new content, one would need to submit a new version of the app to Apple) In the Server model, one creates their own Server (or use a service like Urban Airship) that contains Product information and the appropriate content

  8. Server Delivery Model Content suited for server model includes: Subscriptions, services and content. StoreKit framework does NOT handle interaction between iOS app and server. You may use whatever communication protocol, you choose (but typically Web Services are the best route to go) Store Kit does not provide a mechanism for identifying a particular user.

  9. Store Kit classes SKProductsRequest – used to get list of available products given product identifier strings (defined in iTunes Connect) SKProductsRequestDelegate – delegate class called when Product Request successful SKProductResponse – contains SKProduct for each valid identifier found + info on ones not found

  10. Store Kit classes SKProduct – This class contains localized information about a product (defined in iTunes connect) – description and price. Classes to use to make purchase: SKPayment, SKPaymentQueue SKPaymentTransactionSKPaymentTransactionObserver

  11. Restoring Transactions If your application supports product types that must be restorable, you MUST include a mechanism to allow users to restore the purchases. Store Kit provides built-in functionality to restore transactions for non-consumable products, auto-renewable subscriptions and free subscriptions. To restore transactions, your application calls the payment queue’s restoreCompletedTransactions method.

  12. Verifying receipts After successfully completing in-app purchase, the SKPaymentTransaction has a transactionReceipt property. To have your server verify that this purchase is valid – do a HTTP POST with the following JSON payload (receipt data – Base 64 encoded) to Apple’s production URL. { "receipt-data" : "(receipt bytes here)" }

  13. Testing in-app purchase As of iOS 5 (and higher) you can even do test in-app purchases on the simulator (previously it had to be on a device) Test user accounts are created in iTunes Connect. Verification of receipts should be done against Apple’s Test URL.

  14. Coding Resource If you need a detailed step-by-step, on how to add in-app purchasing – the following resource will be helpful. http://www.raywenderlich.com/2797/introduction-to-in-app-purchases The end result is a generic class, that can be reused for subsequent apps. Only the specifics for your app, need to be specified in subclass

  15. Other implementations MKStoreKit is another commonly used free framework. http://blog.mugunthkumar.com/coding/mkstorekit-4-0-supporting-auto-renewable-subscriptions/ Urban Airship – This is not free (but the Basic plan charges $.10 per In-app purchase). This does avoid the need to implement a server-side component (if needed for your type of in-app purchase)

More Related