12

I am using receipt validation locally on device and targeting iOS 7+

I am testing auto renew subscription in app purchase in the sandbox environment and I noticed this scenario.

-User A is signed in iTunes account on device, purchases subscription in app, gets app receipt. -User A signs out iTunes account on device and User B signs in -User B launches app -User B will continue using User A’s subscription because [[NSBundle mainBundle] appStoreReceiptURL] is valid and will return User A's receipt.

How come it doesn't return User B's receipt?

Dev_Sand
  • 131
  • 4
  • What do you mean by "send"? – Chris Prince Dec 05 '14 at 15:27
  • Oops sorry, what I meant to ask was how come User B's receipt does not get returned from [[NSBundle mainBundle] appStoreReceiptURL] rather still User A's. – Dev_Sand Dec 05 '14 at 16:25
  • I don't see why the receipt should change. appStoreReceiptURL returns a reference to a file. Why should that file change? This said, yes, the use of multiple Apple ID's/iTunes accounts by users does introduce complexities. Say, what if User B now makes a purchase. Restores, done using official Apple methods, are based on Apple ID. So a restore will only restore User A's or User B's purchases. Not both. – Chris Prince Dec 05 '14 at 21:42
  • Right, if I restore User A or B I will get their receipt respectively but only if I do a restore. My question is based on my scenario above, if User A logs out and User B logs in, I won't know this in my app. I want to know this so I can then prompt a refresh receipt. – Dev_Sand Dec 05 '14 at 21:53
  • I don't think you can know this. Apple hides the Apple ID from you. Unless you do a restore *every* time the app launches. But this would be annoying to the user (to enter the password), and I don't know if you have to download assets based on the purchases. – Chris Prince Dec 06 '14 at 00:12
  • Yeah I was leaning towards that as well. I just wanted confirmation from other users. It is so weird that this is the intended behavior from Apple. So basically if I purchase a subscription service on an app and someone uses my phone and logs out of iTunes, he/she can use my app subscription service. Apple is indeed tying subscription service to the device. – Dev_Sand Dec 08 '14 at 15:22
  • I think Apple is shooting for a typical use case of a phone or other mobile device as being a single user device. Do you have an application where multiple Apple ID's will be the common use case? – Chris Prince Dec 08 '14 at 20:37
  • @Dev_Sand, I just found out the exact same issue with my in-app purchase. Are you any wiser since your last post about it or is a restore of the receipt still the only way to deal with this issue? – Soko Jan 15 '15 at 17:01
  • @soko It seems restoring of the receipt is the only way to deal with this issue. – Dev_Sand Jan 20 '15 at 17:59
  • How often do you restore the receipt? Doing it on app start will prompt user to login which is kind of annoying. Have you come up with a better solution than this? – Emil Aug 10 '15 at 20:37
  • If user B have not made any purchases, Should user B get receipt of User A even after Restoring purchases? I have the same issue now. – Alex Apr 26 '18 at 16:48
  • @Dev_Sand were you able to solve this issue. I have tried refreshing the receipt as well but still for user B it returns old user A receipt. – Waqas Jun 12 '23 at 11:50

1 Answers1

0

must refresh the receipt.

    SKReceiptRefreshRequest *request = [[SKReceiptRefreshRequest alloc] init];
    request.delegate = self;
    [request start];
user501836
  • 1,106
  • 1
  • 12
  • 20
  • Even after refreshing the receipt it returns old user receipt while itunes user is changed. – Waqas Jun 12 '23 at 11:49