6

The following extract is from the Apple documents how to restore in App purchases in iOS 7. They say that you can store the receipts and find out later what they user already bought or you can refresh the App Receipt. My questions are:

1) Is there the one app receipt or are there many single receipt?

2) Does it make more sense to store these receipts instead of just storing directly which features the user has already bought

3) How can I examine the receipt that I get from that refresh? All my tries to parse it failed so far.

4) Is there any framework that has a lot of features (saving receipts / bought products on iCloud, making purchases easier, handling downloads, handling all kinds of connection problems, etc.) already? Maybe even with remote server support (and validation).

I hope somebody can help! :)


Refreshing the App Receipt

Create a receipt refresh request, set a delegate, and start the request. The request supports optional properties for obtaining receipts in various states during testing such as expired receipts—for details, see the values for the initWithReceiptProperties: method of SKReceiptRefreshRequest.

request = [[SKReceiptRefreshRequest alloc] init];
request.delegate = self;
[request start];

After the receipt is refreshed, examine it and deliver any products that were added.

hpique
  • 119,096
  • 131
  • 338
  • 476
Max
  • 2,699
  • 2
  • 27
  • 50
  • 3
    This is an example of one of the millions of crappy docs. Man, did I mention I hate every doc Apple ever wrote and will write? They should let people with didactics write their stuff. – Duck Apr 12 '14 at 22:43

1 Answers1

12

1) Is there the one app receipt or are there many single receipt?

There is a single app receipt. Before that, Apple provided receipts for each transaction. Those receipts still exist but are deprecated.

2) Does it make more sense to store these receipts instead of just storing directly which features the user has already bought

Not anymore (for iOS 7 apps).

3) How can I examine the receipt that I get from that refresh? All my tries to parse it failed so far.

This is a complex issue. I suggest reading this unapologetically long answer: https://stackoverflow.com/a/20039394/143378.

4) Is there any framework that has a lot of features (saving receipts / bought products on iCloud, making purchases easier, handling downloads, handling all kinds of connection problems, etc.) already? Maybe even with remote server support (and validation).

There are 3 that I'm aware of:

To date, MKStoreKit appears abandoned and CargoBay doesn't support app receipts. CargoBay has features that RMStore hasn't, and viceversa. I'd check them both and see which one fits your requirements better.

In any case, I recommend reading the StoreKit documentation before using any libraries. The libraries provide code, not understanding.

Disclaimer: I developed RMStore.

Community
  • 1
  • 1
hpique
  • 119,096
  • 131
  • 338
  • 476
  • Hey, thanks for that long answer! So every time Apple send us seomthing, the same receipt is attached to that transaction object? I've already read about RMStore and I've also seen that long answer before ;) I really wanted to use it I have to include OpenSSL to get it work right? Or did I get something wrong? – Max Feb 07 '14 at 09:49
  • I'm taking another look at it now, it looks like you've done something really cool there! – Max Feb 07 '14 at 09:56
  • Thanks. :) It is possible to parse the app receipt without using OpenSSL. I just don't know how. The app receipt is in the app bundle and it gets updated with each transaction. – hpique Feb 07 '14 at 11:11
  • Ah okay I see. Is it possible to store the App receipt (or the info of bought in app purchases) securely in iCloud and then be able to download the content the user owns without him having to enter his password? This is for the user having various devices. – Max Feb 07 '14 at 16:43
  • 1
    It would be technically possible yes. Sadly, not all users have iCloud. Interesting idea. You might want to ask it as a separate question to get more feedback on it, as it might have non-obvious implications. – hpique Feb 07 '14 at 16:46
  • So did I :) http://stackoverflow.com/questions/21640769/ios-in-app-purchase-security-questions – Max Feb 08 '14 at 01:36
  • If I might ask you this here on a side note (in hope you read it): Is it hard to add download support to RMStore? Do you plan it? I feel like the tricky part is to complete the transaction at the right time, when you're sure that everything is downloaded. RMStore seems so perfect to me but I desperately need downloads ;) – Max Feb 08 '14 at 01:53
  • There's a pull request for downloads that is 50% there. Check it out. – hpique Feb 08 '14 at 01:59