IAP auto-renewable
in practice
Cocoaheads Taipei ,2016.12
2
3
In App Purchase
Users use their Apple ID purchase virtual product(s)
Developer use receipt(s) to implement business logic
Financial receive simple report
4
step 1~7
get products user can purchase 

5
6
NSSet *productsIDSet = ["product_identifiers1","product_identifiers2"]
self.productRequest = [[SKProductsRequest alloc]
initWithProductIdentifiers:productsIDSet];
productRequest.delegate = self;
[productRequest start];
7
SKProductsRequestDelegate
- (void)productsRequest:(SKProductsRequest *)request
didReceiveResponse:(SKProductsResponse *)response
{
NSLog(@"receive products %@", response.products);
NSLog(@"invalidProductIdentifiers %@", response.invalidProductIdentifiers);
self.products = response.products;
……
}
[SKProduct] from productsIDSet
8
step 8
user select product to buy 

9
step 8
user select product to buy 

- (void)purchaseProduct:(SKProduct *)inProduct
{
SKPayment *p = [SKPayment paymentWithProduct:inProduct];
[[SKPaymentQueue defaultQueue] addPayment:p];
}
10
step 9 ~11
validate user AppleID/password 

11
step 12 ~14
receive receipt

12
SKPaymentTransactionObserver
- (void)paymentQueue:(SKPaymentQueue *)queue
updatedTransactions:(NSArray *)transactions
{
NSMutableArray *purchasedTransactions = [NSMutableArray array];
for (SKPaymentTransaction *t in transactions) {
switch (t.transactionState) {
case SKPaymentTransactionStatePurchased:
[purchasedTransactions addObject:t];
[[SKPaymentQueue defaultQueue] finishTransaction:t];
break;
//ignore other case in sample code
}
}
if ([purchasedTransactions count] > 0) {
//handle receipts here,continue step 15
}
}
13
step 15~19
verify receipt with Apple server / Your server

14
How server validate a receipt
1.Apple API
receipt product_id
receipt bid
receipt duration(auto-renewable)
https://sandbox.itunes.apple.com/verifyReceipt
https://buy.itunes.apple.com/verifyReceipt
2.DB
ensure receipt transaction_id not used
15
step 20
Deliver purchased content

16
Overview (bad side)
3.1.1 In-App Purchase, 3.1.2 Subscriptions:
If you want to unlock features or functionality within your app,you must use in-app purchase
only verify API, no webhook
When user cancel on iTunes ,Server will not get cancel request.
Can not know which Apple ID user use
Can not know purchase condition until receive receipt
17
A lot of problems we met
18
Receive sandbox receipt on production environment
production validate API ->
receive 21007 status code ->
try sandbox API
Solution:
18
Receive sandbox receipt on production environment
production validate API ->
receive 21007 status code ->
try sandbox API
Solution:
Look like workaround,but it’s spec
19
Critical:Network condition bad When Upload receipt to server
19
Critical:Network condition bad When Upload receipt to server
Business logic

Purchase
Manager
Purchase
Manager
StoreKit
Purchase
ViewController
SKProductsRequestDelegate
SKPaymentTransactionObserverdelegatedelegate
Solution:
cache receipts , remove cache after ensure receipt is uploaded
19
Critical:Network condition bad When Upload receipt to server
Business logic

Purchase
Manager
Purchase
Manager
StoreKit
Purchase
ViewController
SKProductsRequestDelegate
SKPaymentTransactionObserverdelegatedelegate
cache receipts
Solution:
cache receipts , remove cache after ensure receipt is uploaded
19
Critical:Network condition bad When Upload receipt to server
Business logic

Purchase
Manager
Purchase
Manager
StoreKit
Purchase
ViewController
SKProductsRequestDelegate
SKPaymentTransactionObserverdelegatedelegate
cache receipts
trigger API
remove receipts
Solution:
cache receipts , remove cache after ensure receipt is uploaded
19
Critical:Network condition bad When Upload receipt to server
Business logic

Purchase
Manager
Purchase
Manager
StoreKit
Purchase
ViewController
SKProductsRequestDelegate
SKPaymentTransactionObserverdelegatedelegate
cache receipts
trigger API
remove receipts
UI
Solution:
cache receipts , remove cache after ensure receipt is uploaded
20
User purchase on iTunes instead of app
case 1
1.touch purchase product on App
2.when validate AppleID, type wrong password more than 3 times
3.StoreKit ask user to change password
4.redirect to iTunes
5.type correct password and user can purchase on iTunes
21
User purchase on iTunes instead of app
touch this
itms-apps://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptionscase 2
22
User purchase on iTunes instead of app
case 2 https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions
touch this
23
User purchase on iTunes instead of app
Business logic

Purchase
Manager
Purchase
Manager
StoreKit
Purchase
ViewController
SKProductsRequestDelegate
SKPaymentTransactionObserverdelegate
delegate
Solution: init purchase manager at app launch
23
User purchase on iTunes instead of app
Business logic

Purchase
Manager
Purchase
Manager
StoreKit
Purchase
ViewController
SKProductsRequestDelegate
SKPaymentTransactionObserverdelegate
delegate
Solution: init purchase manager at app launch
AppDelegate init at app launch
24
What is receipt (app side)
SKPaymentTransaction
@property(nonatomic, readonly, nullable) NSData *transactionReceipt
/* base64 encode string */
NSString *receiptString = [receipt base64EncodedStringWithOptions:0];
24
What is receipt (app side)
SKPaymentTransaction
@property(nonatomic, readonly, nullable) NSData *transactionReceipt
/* base64 encode string */
NSString *receiptString = [receipt base64EncodedStringWithOptions:0];
25
What is receipt (server side)
25
What is receipt (server side)
25
What is receipt (server side)
26
Critical: Auto-renew fail but user receive charge mail
26
Critical: Auto-renew fail but user receive charge mail
Solution: Trigger Verify API at Next day of expire_date
Not the same day
27
When switch from objC to swift
28
When switch from objC to swift
28
When switch from objC to swift
transactionReceipt property missing
can only use iOS 7 style receipt
29
iOS 7 receipt
29
iOS 7 receipt
29
iOS 7 receipt
30
iOS 7 receipt
30
iOS 7 receipt
31
iOS 6 vs iOS 7 style transaction receipts
• each transaction has unique iOS 6 style receipt
• iOS 7 style receipt get all receipt data in one query
• base64 encode iOS 7 style receipt is much larger than iOS 6 style
32
Will original_transaction_id change?
purchase cancel purchase
again
A C
renew
a long time
B
32
Will original_transaction_id change?
purchase cancel purchase
again
A C
original_transaction_id in receipt A , B and C keep the same
renew
a long time
B
33
Can I manage auto-renewable subscription in Sandbox ?
No.
In addition,sandbox will auto-renew 5 times.
in the end will get 6 receipt
34
What will user see in iTune Connect If my app have multiple auto-
renewable products( A & B)?
34
What will user see in iTune Connect If my app have multiple auto-
renewable products( A & B)?
https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/
manageSubscriptions


This URL will only work for production accounts to display existing auto-renewing
subscriptions for management
35
purchase
product A in app
cancel
auto-renew A
in iTune
purchase
product B in app
product A
expire
What will user see in iTune Connect If my app have multiple auto-
renewable products( A & B)?
35
purchase
product A in app
cancel
auto-renew A
in iTune
purchase
product B in app
product A
expire
What will user see in iTune Connect If my app have multiple auto-
renewable products( A & B)?
iTune display product A product B
36
You can not do anything If
You have a auto renewable product,also set trial period(Eq:1 month)
But Apple receipt trial period is more than your setting
KKTV happen this few times
37
if your service has
account system + multiple platform + multiple payment
37
if your service has
account system + multiple platform + multiple payment
email
facebook
phone number
iOS
Android
Web
PS4
…
IAP
credit card
mobile payment
POSA card
redeem code
convenient store code
38
Example:
User Apple ID KKTV
iTunes
KKTV
Result:
StoreKit
39
Example:
User Apple ID KKTV
iTunes
KKTV
Result:
receipt server
KKTV
Solution:
receipt Alert
39
Example:
User Apple ID KKTV
iTunes
KKTV
Result:
receipt server
KKTV
Solution:
receipt Alert
40
Example:
user IAP
iTunes IAP
40
Example:
user IAP
iTunes IAP
Result
IAP user
40
Example:
user IAP
iTunes IAP
Result
IAP user
Solution
app/server side user iTunes
41
Example:
user
IAP
..... KKTV
KKTV IAP
41
Example:
user
IAP
Result
AppleID user
..... KKTV
KKTV IAP
42
Financial
• report daily
• report user ID transactionID
• user cancel / refund
•
43
Conclusion
• IAP is unfriendly to Developer. But super easy for user.
• Tracking IAP log help find unexpected problems
• Raise IAP price could be an option
44
Reference
TN2387:In-App Purchase Best Practices
TN2413: In-App Purchase FAQ
In-App Purchase Programming Guide
Receipt Validation Programming Guide
WWDC 2016: Using StoreKit for In-App Purchases with Swift 3
WWDC 2014: Optimizing In-App Purchases
WWDC 2012: Selling Products with Store Kit
WWDC 2013: Using Store Kit for In-App Purchases
WWDC 2012: Managing Subscriptions with In-App Purchase
TN2259: Adding In-App Purchase to your iOS and macOS Applications
https://forums.developer.apple.com/community/system-frameworks/in-app-purchase

More Related Content

PDF
Unit Test 最後一哩路
PDF
Refactor code to testable
PDF
Testing In App Billing
PDF
How to implement sso using o auth in golang application
PPTX
Inversion of Control and Dependency Injection
PPTX
Dependency Injection Inversion Of Control And Unity
PDF
Design functional solutions in Java, a practical example
PPT
Ajax Applications with RichFaces and JSF 2
Unit Test 最後一哩路
Refactor code to testable
Testing In App Billing
How to implement sso using o auth in golang application
Inversion of Control and Dependency Injection
Dependency Injection Inversion Of Control And Unity
Design functional solutions in Java, a practical example
Ajax Applications with RichFaces and JSF 2

What's hot (6)

PDF
Dependency injection in Java, from naive to functional
PDF
Distributed banking system using rmi project
PDF
Webauthn Tutorial
PPTX
Dependency injection - the right way
KEY
Application Frameworks - The Good, The Bad & The Ugly
PDF
ASPNET_MVC_Tutorial_06_CS
Dependency injection in Java, from naive to functional
Distributed banking system using rmi project
Webauthn Tutorial
Dependency injection - the right way
Application Frameworks - The Good, The Bad & The Ugly
ASPNET_MVC_Tutorial_06_CS
Ad

Viewers also liked (20)

PDF
SwiftyJSON 慘痛經驗
PDF
接案公司的日子
PDF
軟體接案自由職業者 (Freelancer) 意想不到的風險
PDF
恰如其分的 MySQL 設計技巧 [Modern Web 2016]
PDF
快思慢想讀書會Ch9 10
PPTX
第五章 認知放鬆度 第六章_常模_驚訝與原因
PPTX
Uxpa 2012 Intersection between Accessibility & Plain Language
PDF
THT IAP Certification Presentation Day2 7Dec2010
PDF
Pattern Recognition midterm Proposal
PDF
The Future of Classical Music
PDF
2014-10-25 App 及 Maker 開發者防身術 (MOPCON 2014)
KEY
In-App Purchase
PDF
2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)
PDF
談 Uber 從 PostgreSQL 轉用 MySQL 的技術爭議
PDF
Lecture 06. iOS Programming. Основи Objective-C
PDF
資料庫索引數據結構及主鍵設計(b+tree)(part 1)
PDF
Enterprise Architecture Case in PHP (MUZIK Online)
PDF
淺入淺出 MySQL & PostgreSQL
PDF
Redis, another step on the road
PDF
適合資工系畢業生的 一百零一種工作
SwiftyJSON 慘痛經驗
接案公司的日子
軟體接案自由職業者 (Freelancer) 意想不到的風險
恰如其分的 MySQL 設計技巧 [Modern Web 2016]
快思慢想讀書會Ch9 10
第五章 認知放鬆度 第六章_常模_驚訝與原因
Uxpa 2012 Intersection between Accessibility & Plain Language
THT IAP Certification Presentation Day2 7Dec2010
Pattern Recognition midterm Proposal
The Future of Classical Music
2014-10-25 App 及 Maker 開發者防身術 (MOPCON 2014)
In-App Purchase
2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)
談 Uber 從 PostgreSQL 轉用 MySQL 的技術爭議
Lecture 06. iOS Programming. Основи Objective-C
資料庫索引數據結構及主鍵設計(b+tree)(part 1)
Enterprise Architecture Case in PHP (MUZIK Online)
淺入淺出 MySQL & PostgreSQL
Redis, another step on the road
適合資工系畢業生的 一百零一種工作
Ad

Similar to IAP auto renewable in practice (20)

PPTX
Self checkout application presentation
PPTX
Batch_60_MainProject_finalreview000.pptx
PPTX
PowerBI Embedded in D365 Finance and Operations
PPTX
MeasureCamp London 2024 - Yasen - Measurement Protocol v2
PDF
Dropwizard with MongoDB and Google Cloud
PDF
API Security - OWASP top 10 for APIs + tips for pentesters
PDF
App Store Subscriptions - Condensed Edition
PDF
Diving into VS 2015 Day4
PDF
Adjust Workshop - PUSHING AND PULLING YOUR DATA
KEY
Android In-App Billing @ Droidcon 2011
PPTX
Batch_60_MainProject_finalreview-02.pptx
PDF
QSDA2022: Qlik Sense Data Architect | Q & A
PPTX
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
KEY
Android In-App Billing @ Barcelona GTUG
PDF
Rethinking your mobile tracking strategy by Ekaterina Petrakova
PDF
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
PDF
5 Things Every Product Leader Needs to Know About API
PPTX
Z101666 best practices for delivering hybrid cloud capability with apis
PDF
Implémentez une intégration avec AEM presque sans code
PPTX
Introduction to aop
Self checkout application presentation
Batch_60_MainProject_finalreview000.pptx
PowerBI Embedded in D365 Finance and Operations
MeasureCamp London 2024 - Yasen - Measurement Protocol v2
Dropwizard with MongoDB and Google Cloud
API Security - OWASP top 10 for APIs + tips for pentesters
App Store Subscriptions - Condensed Edition
Diving into VS 2015 Day4
Adjust Workshop - PUSHING AND PULLING YOUR DATA
Android In-App Billing @ Droidcon 2011
Batch_60_MainProject_finalreview-02.pptx
QSDA2022: Qlik Sense Data Architect | Q & A
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
Android In-App Billing @ Barcelona GTUG
Rethinking your mobile tracking strategy by Ekaterina Petrakova
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
5 Things Every Product Leader Needs to Know About API
Z101666 best practices for delivering hybrid cloud capability with apis
Implémentez une intégration avec AEM presque sans code
Introduction to aop

More from Hokila Jan (9)

PDF
Tracking Event validator
PDF
Preparation for wwdc and not waste it
PDF
Third party module strategy
PDF
How to cheat jb detector and detect cheating
PDF
進擊的帳單
PDF
讓你的App優雅的crash三部曲
PDF
iOS app security
PDF
快思慢想Ch13 14
PPTX
從Scrum到放棄scrum
Tracking Event validator
Preparation for wwdc and not waste it
Third party module strategy
How to cheat jb detector and detect cheating
進擊的帳單
讓你的App優雅的crash三部曲
iOS app security
快思慢想Ch13 14
從Scrum到放棄scrum

Recently uploaded (20)

PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
Visual explanation of Dijkstra's Algorithm using Python
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
most interesting chapter in the world ppt
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PDF
MCP Security Tutorial - Beginner to Advanced
PPTX
Cybersecurity: Protecting the Digital World
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PDF
Workplace Software and Skills - OpenStax
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PPTX
Computer Software - Technology and Livelihood Education
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PPTX
Airline CRS | Airline CRS Systems | CRS System
PPTX
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
DNT Brochure 2025 – ISV Solutions @ D365
Visual explanation of Dijkstra's Algorithm using Python
iTop VPN Crack Latest Version Full Key 2025
most interesting chapter in the world ppt
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
Matchmaking for JVMs: How to Pick the Perfect GC Partner
MCP Security Tutorial - Beginner to Advanced
Cybersecurity: Protecting the Digital World
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Workplace Software and Skills - OpenStax
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
Full-Stack Developer Courses That Actually Land You Jobs
How to Use SharePoint as an ISO-Compliant Document Management System
Computer Software - Technology and Livelihood Education
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
BoxLang Dynamic AWS Lambda - Japan Edition
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Airline CRS | Airline CRS Systems | CRS System
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...

IAP auto renewable in practice

  • 2. 2
  • 3. 3 In App Purchase Users use their Apple ID purchase virtual product(s) Developer use receipt(s) to implement business logic Financial receive simple report
  • 4. 4 step 1~7 get products user can purchase 

  • 5. 5
  • 6. 6 NSSet *productsIDSet = ["product_identifiers1","product_identifiers2"] self.productRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productsIDSet]; productRequest.delegate = self; [productRequest start];
  • 7. 7 SKProductsRequestDelegate - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { NSLog(@"receive products %@", response.products); NSLog(@"invalidProductIdentifiers %@", response.invalidProductIdentifiers); self.products = response.products; …… } [SKProduct] from productsIDSet
  • 8. 8 step 8 user select product to buy 

  • 9. 9 step 8 user select product to buy 
 - (void)purchaseProduct:(SKProduct *)inProduct { SKPayment *p = [SKPayment paymentWithProduct:inProduct]; [[SKPaymentQueue defaultQueue] addPayment:p]; }
  • 10. 10 step 9 ~11 validate user AppleID/password 

  • 12. 12 SKPaymentTransactionObserver - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { NSMutableArray *purchasedTransactions = [NSMutableArray array]; for (SKPaymentTransaction *t in transactions) { switch (t.transactionState) { case SKPaymentTransactionStatePurchased: [purchasedTransactions addObject:t]; [[SKPaymentQueue defaultQueue] finishTransaction:t]; break; //ignore other case in sample code } } if ([purchasedTransactions count] > 0) { //handle receipts here,continue step 15 } }
  • 13. 13 step 15~19 verify receipt with Apple server / Your server

  • 14. 14 How server validate a receipt 1.Apple API receipt product_id receipt bid receipt duration(auto-renewable) https://sandbox.itunes.apple.com/verifyReceipt https://buy.itunes.apple.com/verifyReceipt 2.DB ensure receipt transaction_id not used
  • 16. 16 Overview (bad side) 3.1.1 In-App Purchase, 3.1.2 Subscriptions: If you want to unlock features or functionality within your app,you must use in-app purchase only verify API, no webhook When user cancel on iTunes ,Server will not get cancel request. Can not know which Apple ID user use Can not know purchase condition until receive receipt
  • 17. 17 A lot of problems we met
  • 18. 18 Receive sandbox receipt on production environment production validate API -> receive 21007 status code -> try sandbox API Solution:
  • 19. 18 Receive sandbox receipt on production environment production validate API -> receive 21007 status code -> try sandbox API Solution: Look like workaround,but it’s spec
  • 20. 19 Critical:Network condition bad When Upload receipt to server
  • 21. 19 Critical:Network condition bad When Upload receipt to server Business logic
 Purchase Manager Purchase Manager StoreKit Purchase ViewController SKProductsRequestDelegate SKPaymentTransactionObserverdelegatedelegate Solution: cache receipts , remove cache after ensure receipt is uploaded
  • 22. 19 Critical:Network condition bad When Upload receipt to server Business logic
 Purchase Manager Purchase Manager StoreKit Purchase ViewController SKProductsRequestDelegate SKPaymentTransactionObserverdelegatedelegate cache receipts Solution: cache receipts , remove cache after ensure receipt is uploaded
  • 23. 19 Critical:Network condition bad When Upload receipt to server Business logic
 Purchase Manager Purchase Manager StoreKit Purchase ViewController SKProductsRequestDelegate SKPaymentTransactionObserverdelegatedelegate cache receipts trigger API remove receipts Solution: cache receipts , remove cache after ensure receipt is uploaded
  • 24. 19 Critical:Network condition bad When Upload receipt to server Business logic
 Purchase Manager Purchase Manager StoreKit Purchase ViewController SKProductsRequestDelegate SKPaymentTransactionObserverdelegatedelegate cache receipts trigger API remove receipts UI Solution: cache receipts , remove cache after ensure receipt is uploaded
  • 25. 20 User purchase on iTunes instead of app case 1 1.touch purchase product on App 2.when validate AppleID, type wrong password more than 3 times 3.StoreKit ask user to change password 4.redirect to iTunes 5.type correct password and user can purchase on iTunes
  • 26. 21 User purchase on iTunes instead of app touch this itms-apps://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptionscase 2
  • 27. 22 User purchase on iTunes instead of app case 2 https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions touch this
  • 28. 23 User purchase on iTunes instead of app Business logic
 Purchase Manager Purchase Manager StoreKit Purchase ViewController SKProductsRequestDelegate SKPaymentTransactionObserverdelegate delegate Solution: init purchase manager at app launch
  • 29. 23 User purchase on iTunes instead of app Business logic
 Purchase Manager Purchase Manager StoreKit Purchase ViewController SKProductsRequestDelegate SKPaymentTransactionObserverdelegate delegate Solution: init purchase manager at app launch AppDelegate init at app launch
  • 30. 24 What is receipt (app side) SKPaymentTransaction @property(nonatomic, readonly, nullable) NSData *transactionReceipt /* base64 encode string */ NSString *receiptString = [receipt base64EncodedStringWithOptions:0];
  • 31. 24 What is receipt (app side) SKPaymentTransaction @property(nonatomic, readonly, nullable) NSData *transactionReceipt /* base64 encode string */ NSString *receiptString = [receipt base64EncodedStringWithOptions:0];
  • 32. 25 What is receipt (server side)
  • 33. 25 What is receipt (server side)
  • 34. 25 What is receipt (server side)
  • 35. 26 Critical: Auto-renew fail but user receive charge mail
  • 36. 26 Critical: Auto-renew fail but user receive charge mail Solution: Trigger Verify API at Next day of expire_date Not the same day
  • 37. 27 When switch from objC to swift
  • 38. 28 When switch from objC to swift
  • 39. 28 When switch from objC to swift transactionReceipt property missing can only use iOS 7 style receipt
  • 45. 31 iOS 6 vs iOS 7 style transaction receipts • each transaction has unique iOS 6 style receipt • iOS 7 style receipt get all receipt data in one query • base64 encode iOS 7 style receipt is much larger than iOS 6 style
  • 46. 32 Will original_transaction_id change? purchase cancel purchase again A C renew a long time B
  • 47. 32 Will original_transaction_id change? purchase cancel purchase again A C original_transaction_id in receipt A , B and C keep the same renew a long time B
  • 48. 33 Can I manage auto-renewable subscription in Sandbox ? No. In addition,sandbox will auto-renew 5 times. in the end will get 6 receipt
  • 49. 34 What will user see in iTune Connect If my app have multiple auto- renewable products( A & B)?
  • 50. 34 What will user see in iTune Connect If my app have multiple auto- renewable products( A & B)? https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/ manageSubscriptions 
 This URL will only work for production accounts to display existing auto-renewing subscriptions for management
  • 51. 35 purchase product A in app cancel auto-renew A in iTune purchase product B in app product A expire What will user see in iTune Connect If my app have multiple auto- renewable products( A & B)?
  • 52. 35 purchase product A in app cancel auto-renew A in iTune purchase product B in app product A expire What will user see in iTune Connect If my app have multiple auto- renewable products( A & B)? iTune display product A product B
  • 53. 36 You can not do anything If You have a auto renewable product,also set trial period(Eq:1 month) But Apple receipt trial period is more than your setting KKTV happen this few times
  • 54. 37 if your service has account system + multiple platform + multiple payment
  • 55. 37 if your service has account system + multiple platform + multiple payment email facebook phone number iOS Android Web PS4 … IAP credit card mobile payment POSA card redeem code convenient store code
  • 56. 38 Example: User Apple ID KKTV iTunes KKTV Result: StoreKit
  • 57. 39 Example: User Apple ID KKTV iTunes KKTV Result: receipt server KKTV Solution: receipt Alert
  • 58. 39 Example: User Apple ID KKTV iTunes KKTV Result: receipt server KKTV Solution: receipt Alert
  • 61. 40 Example: user IAP iTunes IAP Result IAP user Solution app/server side user iTunes
  • 64. 42 Financial • report daily • report user ID transactionID • user cancel / refund •
  • 65. 43 Conclusion • IAP is unfriendly to Developer. But super easy for user. • Tracking IAP log help find unexpected problems • Raise IAP price could be an option
  • 66. 44 Reference TN2387:In-App Purchase Best Practices TN2413: In-App Purchase FAQ In-App Purchase Programming Guide Receipt Validation Programming Guide WWDC 2016: Using StoreKit for In-App Purchases with Swift 3 WWDC 2014: Optimizing In-App Purchases WWDC 2012: Selling Products with Store Kit WWDC 2013: Using Store Kit for In-App Purchases WWDC 2012: Managing Subscriptions with In-App Purchase TN2259: Adding In-App Purchase to your iOS and macOS Applications https://forums.developer.apple.com/community/system-frameworks/in-app-purchase