Non-renewing Subscriptions: Removed From Receipt?

后端 未结 2 2014
暗喜
暗喜 2020-12-14 03:55

I\'m implementing in-app purchases for my app (to be released), and providing support for iOS6 and iOS7. My question has to do with differences between non-renewing subscrip

相关标签:
2条回答
  • 2020-12-14 04:08

    Be careful, persisting non-renewing subscriptions in App Receipt gives you no guarantee to be accepted by App Store reviewers. The success depends on particular reviewer. I've got this message from Apple recently:

    We found that your app includes a feature to restore previously purchased In-App Purchase products by entering the user's Apple ID and password. However, Non-Renewing Subscription In-App Purchases cannot be restored in this manner.

    It would be appropriate to revise your binary to remove this feature. If you would like users to be able to restore Non-Renewing Subscription In-App Purchase products, you will need to implement your own restore mechanism.

    So the last attempt to submit the app was unlucky. Unlike the previous few.

    So now, my plan is to store the App Receipt on iCloud Key-Value Storage and automatically restore all the purchases. It would satisfy Apples requests:

    For non-renewing subscriptions, use iCloud or your own server to keep a persistent record. (c) Store Kit Programming Guide

    here is the Apple's code provided for these purposes:

    #if USE_ICLOUD_STORAGE
    NSUbiquitousKeyValueStore *storage = [NSUbiquitousKeyValueStore defaultStore];
    #else
    NSUserDefaults *storage = [NSUserDefaults standardUserDefaults];
    #endif
    
    NSData *newReceipt = transaction.transactionReceipt;
    NSArray *savedReceipts = [storage arrayForKey:@"receipts"];
    if (!receipts) {
        // Storing the first receipt
        [storage setObject:@[newReceipt] forKey:@"receipts"];
    } else {
        // Adding another receipt
        NSArray *updatedReceipts = [savedReceipts arrayByAddingObject:newReceipt];
        [storage setObject:updatedReceipts forKey:@"receipts"];
    }
    
    [storage synchronize];
    
    0 讨论(0)
  • 2020-12-14 04:24

    This has also been puzzling the heck outta me. After looking at the docs many times, I finally saw the following in the receipt field notes for the Receipt Validation Programming Guide:

    The in-app purchase receipt for a consumable product is added to the receipt when the purchase is made. It is kept in the receipt until your app finishes that transaction. After that point, it is removed from the receipt the next time the receipt is updated—for example, when the user makes another purchase or if your app explicitly refreshes the receipt.

    The in-app purchase receipt for a non-consumable product, auto-renewable subscription, non-renewing subscription, or free subscription remains in the receipt indefinitely.

    Whereas the section on "Persisting Using the App Receipt" in the In-App Purchase Programming Guide still indicates that consumables and non-renewing subscriptions are treated the same.

    I'm guessing from the behavior that we are observing that the IAP document is out of date? I hope so.

    0 讨论(0)
提交回复
热议问题