3

A college of mine has implemented iOS in-app purchasing on a auto-renewing monthly basis. I am taking over the code base and want to test it is working. I know the purchasing is wokring but the auto-renewing is what I am worried about.

I have set up a test user and read the Apple documentation that says in sandbox mode, a month is 5 minutes in the sandbox.

However I am not getting any post back from Apple after 5 minutes? should I?

In the AppDelegate I have

 inAppPurchase = [TFInAppPurchase new];
[[SKPaymentQueue defaultQueue] addTransactionObserver:inAppPurchase];
[inAppPurchase updateAvailableProductsCache];

I am expecting after 5 minutes, it to fire of a notification or something?

Burf2000
  • 5,001
  • 14
  • 58
  • 117

3 Answers3

15

In the iTunes development guide, there's list of how long auto-renew subscriptions last in sandbox mode:

Sandbox Testing Your In-App Purchases

You are required to test your in-app purchases in a sandbox environment before you submit them for review by Apple. You must first sign out of your iTunes Store account from your test device Settings before attempting to use the sandbox environment. If you mistakenly use your test-user-account credentials to log in to a production environment on your test device (instead of in to your test environment), your account credentials become invalid and cannot be used as a test account again. For more details on how to avoid mistakes during test account use, see “Using Test User Accounts.”

When testing auto-renewable in-app purchase subscriptions in the sandbox environment, the duration times will be compressed to allow for more streamlined testing. Additionally, a sandbox subscription will only auto-renew a maximum of 6 times. After the subscription has auto-renewed 6 times, it will no longer renew in the sandbox. The compressed duration times are as follows:

   Actual duration      Sandbox duration
   1 week               3 minutes 
   1 month              5 minutes
   2 months             10 minutes 
   3 months             15 minutes 
   6 months             30 minutes 
   1 year               1 hour
Community
  • 1
  • 1
Scott Bossak
  • 2,471
  • 20
  • 17
  • 1
    Thanks, sadly I already know this, however I get no update at 5 minutes or anything which is why I posted the question – Burf2000 Feb 05 '13 at 15:50
  • Are you verifying the receipt? Apple does not post a notification when the subscription expires. It's up to you to determine if the subscription is still valid? When you verify, code 21006 is an expired receipt. https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/RenewableSubscriptions/RenewableSubscriptions.html#//apple_ref/doc/uid/TP40008267-CH4-SW2 – Scott Bossak Feb 05 '13 at 16:04
  • What about the renewal, Does apple send a notification of renewal? I am not checking any receipt, I just want to add a month to the cms that controls the system everytime they renew – Burf2000 Feb 05 '13 at 16:27
  • You might have to check the `latest_receipt_info` field in the receipt to check the latest expiration date. Apple doesn't post notifications about IAP. This might help you with verifying receipts: https://www.beeblex.com/public/ – Scott Bossak Feb 05 '13 at 16:36
  • I have got the working link of the sandbox duration http://nathanmock.com/files/com.apple.adc.documentation.AppleiOS6.0.iOSLibrary.docset/Contents/Resources/Documents/#documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/13_ManagingIn-AppPurchases_Robert/ManagingIn-AppPurchases.html – Pawan Sharma Sep 18 '14 at 13:52
  • 1
    Here's an updated link to the Apple doc: [Testing Auto-Renewable Subscriptions](https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/TestingInAppPurchases.html#//apple_ref/doc/uid/TP40013727-CH4-SW5) – n8tr Jan 14 '15 at 16:46
4

There is no notification. You keep track of it yourself (the duration). You get a receipt with the original transaction that you save. Use this to verify (perhaps on launch each time) that the user's subscription is still active.

Joris Weimar
  • 4,783
  • 4
  • 33
  • 53
0

No notification will be generated by apple. You have to save the recipes on server or device by using nsuserdefaults or keychain. you have to track the duration by yourself.By caluclating Compare the product identifier in question to the product identifier of each in-app purchase receipt. If there is a receipt that matches, validation succeeds. Otherwise, validation fails.

When validation succeeds, your application enables the purchased functionality—for example, by downloading content or adding features. When validation fails, your application simply does not enable the functionality.

Lova
  • 134
  • 7