In App Purchase

9,239 views

Published on

In App Purchase talk for iPhone Dev Camp 09

Published in: Technology, Business
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
9,239
On SlideShare
0
From Embeds
0
Number of Embeds
67
Actions
Shares
0
Downloads
191
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • After this slide Survey audience to see who plans on using each different pricing model.
  • In App Purchase

    1. 1. Presented by: Steven Osborn<br />@steve918<br />steven@urbanairship.com<br />In App Purchase<br />
    2. 2. What can I do with it?<br />iPhoneDevCamp3<br />A basic version of your application with additional premium features.<br />A book reader application that allows the user to purchase and download new books.<br />A game that offers new environments (levels) to explore.<br />An online game that allows the player to purchase new virtual property.<br />(Examples from programming guide)<br />
    3. 3. Who’s doing what.<br />iPhoneDevCamp3<br />Real world examples<br />
    4. 4. Flick Fishing<br />Enigmo<br />iPhoneDevCamp3<br />Doing it right<br />
    5. 5. Doing it wrong.<br />iPhoneDevCamp3<br />
    6. 6. Same Pricing structure as applications.<br />$0.99, 1.99, 2.99 - 129.99<br />iPhoneDevCamp3<br />Pricing Structure<br />
    7. 7. No “Freemium”!<br />iPhoneDevCamp3<br />Free apps have to be totally free<br />Paid apps can have In-App-Purchase content<br />Why not?<br />
    8. 8. <ul><li>NoN-Consumable
    9. 9. Consumable
    10. 10. Subscription</li></ul>iPhoneDevCamp3<br />Pricing Product Models<br />
    11. 11. Non-Consumable<br />iPhoneDevCamp3<br />User purchases content once.<br />Content can be re-downloadable/re-enabled without additional purchase.<br />This is how App purchases work now.<br />Content can be easily restored.<br />
    12. 12. Consumable<br />iPhoneDevCamp3<br />Content can be purchased multiple times.<br />User is gently reminded that they’ve already purchased the content once before.<br />Content cannot be restored through the AppStore. (You would have to provide your own persistence and accounting.)<br />
    13. 13. Subscription<br />iPhoneDevCamp3<br />Totally broken<br />Not automatically reoccurring<br />User is nagged monthly<br />You keep track of when to nag the user to repurchase<br />
    14. 14. <ul><li> Self contained
    15. 15. Downloadable</li></ul>iPhoneDevCamp3<br />Distribution Models<br />
    16. 16. Self-Contained Model<br />Embed your content in your application and just turn it on once the user has purchased it.<br />iPhoneDevCamp3<br />
    17. 17. Self-Contained Model<br />iPhoneDevCamp3<br />Embed content in your application<br />User purchases content and Apple verifies payment<br />Application unlocks functionality<br />Apple takes 30% of your money<br />
    18. 18. Pros<br />Cons<br />iPhoneDevCamp3<br />Easy to implement<br />No server cost<br />Content can not be changed or updated (without updating you application)<br />Might push you over 10mb wireless download size.<br />Self-Contained Model<br />
    19. 19. Downloadable Content <br />Download the content from some server in the cloud once Apple verifies payment receipt.<br />iPhoneDevCamp3<br />
    20. 20. Downloadable Content (simplified) <br />iPhoneDevCamp3<br />Fetch products from server<br />Fetch descriptions and price from Apple<br />User selects item from store and sends payment request to Apple<br />Apple returns receipt<br />iPhone relays receipt to server<br />Server verifies receipt through Apple back-channel and provides content<br />Apple takes 30% of your money<br />
    21. 21. Pros<br />Cons<br />iPhoneDevCamp3<br />Dynamic content<br />Keep application size under 10mb<br />More secure (out of band receipt verification)<br />Difficult to implement<br />Server maintenance/cost<br />You have to take care of content versioning and updates<br />Downloadable Content <br />
    22. 22. Technical mumbo-jumb<br />100mph overview<br /><ul><li> Get Product Info
    23. 23. Request Payments
    24. 24. Listen for transaction updates</li></ul>iPhoneDevCamp3<br />How it works<br />
    25. 25. Products (SKProduct)<br />iPhoneDevCamp3<br />Each product has a unique productIdentifier<br />Localized description<br />Localized name<br />
    26. 26. Info about Products (SKProductsRequest)<br />iPhoneDevCamp3<br />Takes an NSSet of product identifiers and retrieves a list of products and meta-data(SKProductsResponse) from the server.<br />NSSet* products = [NSSetsetWithObject: @”Foo”];<br />SKProductsRequest *request= [[SKProductsRequestalloc] initWithProductIdentifiers: products];<br />- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {<br />
    27. 27. Transaction Observer (register)<br />iPhoneDevCamp3<br />MyStoreObserver *observer = [[MyStoreObserveralloc] init];<br />[[SKPaymentQueuedefaultQueue] addTransactionObserver:observer];<br />
    28. 28. Collect Payment<br />iPhoneDevCamp3<br />SKPayment *payment = [SKPaymentpaymentWithProductIdentifier: @”Foo”];<br />[[SKPaymentQueuedefaultQueue] addPayment:payment]; <br />
    29. 29. Transaction Observer (Listen)<br />iPhoneDevCamp3<br />-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {<br /> for (SKPaymentTransaction *transaction in transactions){<br /> switch (transaction.transactionState) {<br /> case SKPaymentTransactionStatePurchased: <br /> [self completeTransaction:transaction]; <br /> break; <br /> case SKPaymentTransactionStateFailed: <br /> [self failedTransaction:transaction];<br /> break;<br /> case SKPaymentTransactionStateRestored:<br /> [self restoreTransaction:transaction];<br /> default:<br /> break;<br />}}} <br />
    30. 30. FAIL!<br />iPhoneDevCamp3<br />-(void) failedTransaction: (SKPaymentTransaction *)transaction {<br /> if (transaction.error.code != SKErrorPaymentCancelled) {<br /> // Optionally, display an error here.<br /> }<br /> [[SKPaymentQueuedefaultQueue] finishTransaction: transaction];<br /> } <br />
    31. 31. WIN!<br />iPhoneDevCamp3<br />(void) completeTransaction: (SKPaymentTransaction *)transaction {<br /> [self recordTransaction: transaction];<br /> [self provideContent: transaction.payment.productIdentifier [[SKPaymentQueuedefaultQueue]finishTransaction: transaction]; <br />} <br />
    32. 32. Restoring Non-Consumables<br />iPhoneDevCamp3<br />// can haz stuff back<br />[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];<br />
    33. 33. Verify Receipt (Python)<br />iPhoneDevCamp3<br />def verify_receipt(app, raw_apple_data):<br />conn = httplib.HTTPSConnection(app.verify_server)<br /> body = {&apos;receipt-data&apos;: base64.encodestring(str(raw_apple_data))}<br />json_body = json.dumps(body)<br />conn.request(&quot;POST&quot;, &quot;/verifyReceipt&quot;, json_body, {&apos;Content-type&apos;:<br /> &apos;application/json&apos;})<br /> response = conn.getresponse()<br /> return response<br />
    34. 34. Verify Receipt (Cont)<br />iPhoneDevCamp3<br /> response = verify_receipt(app, data[&apos;transaction_receipt&apos;])<br /> try:<br />response_data = json.loads(response.read())<br /> except ValueError:<br />response_data = {}<br /> status = response_data.get(&apos;status&apos;, &apos;unknown&apos;)<br /> if response.status == 200 and status == 0:<br />recpt = app_models.Receipt.from_json(response_data, app)<br />
    35. 35. Parts I left out…<br />iPhoneDevCamp3<br />Dynamically populating UI with inventory<br />Downloading the content from the server<br />Possibly decompressing it<br />Content updates<br />All of the server code and client connection points<br />
    36. 36. I have the Power!<br />iPhoneDevCamp3<br />
    37. 37. Easy Peasy<br /><ul><li> Upload content
    38. 38. Launch StoreFront
    39. 39. ????
    40. 40. Profit!!</li></ul>iPhoneDevCamp3<br />Urban Airship - StoreFront<br />
    41. 41. First!<br />iPhoneDevCamp3<br />[Airship takeOff: @”&lt;key&gt;” identifiedBy: @”&lt;secret&gt;&quot;];<br />[[Airship shared] displayStoreFront];<br />
    42. 42. StoreFront<br />iPhoneDevCamp3<br />
    43. 43. Custom Client UI/Same server<br />iPhoneDevCamp3<br />
    44. 44. Hook up new content<br />iPhoneDevCamp3<br />All content is downloaded and decompressed into the applications ‘Documents’ directory.<br />
    45. 45. Benefits<br />iPhoneDevCamp3<br />Content versioning and updates<br />Free content. You can have additional content that doesn’t cost anything.<br />We take care of servers, load balancing and redundancy<br />Works with out push notification system so that users can receive automatic notification when there is new content.<br />
    46. 46. Working StoreKit Code, Yay!<br />iPhoneDevCamp3<br />Lets See it!<br />
    47. 47. BSDLicense<br />Mercurial, bz2, tar, zip<br />iPhoneDevCamp3<br />Open Source – Beta*<br />http://bitbucket.org/urbanairship/storefront/<br />*Real beta (Not Google version of beta) – There be bugs.<br />
    48. 48. Thanks<br />iPhoneDevCamp3<br />Twitter: @steve918<br />Email: steven@urbanairship.com<br />http://urbanairship.com/developers/<br />Slides available at:<br />http://steven.bitsetters.com/talks/<br />

    ×