Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unpredictable Sandbox Environment for IAP Auto-...

denkeni
November 09, 2020

Unpredictable Sandbox Environment for IAP Auto-renewable Subscriptions

denkeni

November 09, 2020
Tweet

More Decks by denkeni

Other Decks in Programming

Transcript

  1. © 2020 Denken All rights reserved. Redistribution or public display

    not permitted without written permission from Denken. https://denkeni.medium.com/unpredictable-sandbox-environment-for-iap-auto-renewable-subscriptions-44461d7b1378 Unpredictable Sandbox Environment for IAP Auto-renewable Subscriptions Denken Chen, Confused iOS App Developer #WWDC20 #WorldWideDevelopersConfused20
  2. Sandbox Tester On iOS 14 simulator WWDC20 Introducing StoreKit Testing

    in Xcode No Account Purchase develop on simulator Sandbox /verifyReceipt develop on device Production /verifyReceipt develop on device
  3. Sandbox Tester Only on real iOS device Just use your

    Apple ID Single Account Purchase develop on simulator Sandbox /verifyReceipt develop on device Production /verifyReceipt develop on device
  4. Sandbox Tester Create more sandbox testers on App Store Connect

    Email address that has never been used as an Apple ID Apple officially recommends using subaddressing You may still get stuck for multiple unclear reasons Multiple Accounts: Creation
  5. Sandbox Tester iOS device — Settings — iTunes & App

    Store Log out current account DO NOT log in sandbox tester account here Purchase IAP with sandbox tester account Multiple Accounts: How to Use
  6. Sandbox Tester “Important: Don’t use your test user account to

    sign in to the production environment. If you do, the test user account becomes invalid and can no longer be used.” from In-App Purchase Programming Guide — Retrieving Product Information — Suggested Testing Steps Multiple Accounts: Warning
  7. Sandbox Tester Xcode 12 App Review Purchase develop on simulator

    Sandbox /verifyReceipt develop on device Production /verifyReceipt develop on device Xcode TestFlight App Review App Store “Verify your receipt first with the production URL; proceed to verify with the sandbox URL if you receive a 21007 status code.”
  8. Subscription Management Xcode 12 → Subscription Options(?) Purchase develop on

    simulator Sandbox /verifyReceipt develop on device Production /verifyReceipt develop on device iOS 14 Settings → App Store → Sandbox Account iOS Settings or App Store → Profile → Subscriptions
  9. Subscription Management “Maximum” 5 automatic renewals* Usually starts with 5

    renewals, and no renewal afterwards. How long the cooldown time is? Probably hours. Auto-renewable Subscriptions * WWDC 2018 Session 704 slides P.37
  10. Billing Retry Service Recovery Rate from 30.0% to 77.4%, just

    amazing(*) is_in_billing_retry_period randomly for true DID_FAIL_TO_RENEW and DID_RECOVER notification * WWDC 2019 Session 302 slides P.215
  11. App Store Server Your Server Status Polling App Store Notifications

    Server-to-Server Notifications Status Update Notifications NSNotificationCenter Apple Push Notification Service /verifyReceipt Receipt
  12. App Store Server Notification CANCEL Indicates that either Apple customer

    support canceled the subscription or the user upgraded their subscription. (*1) This event is not the same as when the user enters their iTunes account — Subscription section, and indicates that they choose not to allow an existing auto-renewing subscription to renew. (*2, and see DID_CHANGE_RENEWAL_STATUS) RTFM (*1) https://developer.apple.com/documentation/appstoreservernotifications/notification_type (*2) https://forums.developer.apple.com/thread/98894#thread-message-301062
  13. App Store Server Notification RTFM (*1) https://developer.apple.com/documentation/appstoreservernotifications/notification_type (*2) https://forums.developer.apple.com/thread/98894#thread-message-301062 RENEWAL

    (it’s been renamed as DID_RECOVER) Indicates a successful automatic renewal of an expired subscription that failed to renew in the past. Check expires_date to determine the next renewal date and time. (*1, and see DID_RENEW) In general, iTunes will attempt to charge the user account a day before an auto-renewing subscription is scheduled to expire... in the few cases that iTunes is unable to renew the subscription (generally there was a connection problem with the credit card server)... technically considered “expired”. However, iTunes will still continue to attempt to renew the subscription. If iTunes is successful, then the “RENEWAL” event is sent. (*2)
  14. App Store Server Notification DID_CHANGE_RENEWAL_PREF Indicates that the customer made

    a change in their subscription plan that takes effect at the next renewal. (Downgrade) DID_CHANGE_RENEWAL_STATUS Indicates a change in the subscription renewal status. (Toggling auto-renew on/off.) INTERACTIVE_RENEWAL Indicates the customer renewed a subscription interactively, ... (Upgrade or renew) RTFM * https://developer.apple.com/documentation/appstoreservernotifications/notification_type * https://developer.apple.com/videos/play/wwdc2020/10661/?time=14m19s
  15. Summary Beware of sandbox tester creation Subscription Management is okay

    in 2020 Billing Retry Service is okay in 2020 App Store Server Notification — RTFM