4

As title said, I am implementing a flow to fetch a local receipt then try to validate it from our backend server. As what Apple suggested, if the receipt tis nil or invalid. I need to do a receipt refresh request, the problem is, this requires network as well as user login.

So the actual issue we are facing is, from the dev build and test flight build, when we build a fresh new app that has not opened before. Once open, it will show a popup to ask for user login (obviously it's because of my logic - if receipt nil then do receipt refresh request). But we don't want to spam user with this dialog box every time and we have the business need to validate the user's receipt at app start up.

So back to the title question, since the dev and test flight build isn't working as expected (show login dialog because receipt is nil). Does the prod build - the app download from App Store, actually issues a receipt from App Store? In a WWDC video they said it should, but not very specific, so I am here to get some confirmation or some other thoughts from you guys.

Thanks!!

Tony Lin
  • 922
  • 6
  • 25

1 Answers1

3

It's been a long time since I've used receipt validation (I used for auto renewable subscription) so what I'm going to tell you could have been changed. In my experience it never happen to receive a nil receipt in production since the first receipt is downloaded from the App Store along with the application even for free apps.
nil receipt happens in sandbox and in adhoc (don't know which should be the right behavior from from TestFlight) and in this case the best way to replicate production is to "restore purchases" or make a refresh request.
There is an old discussion about it on Apple dev forum where an employee clarifies that(probably 2015), I'm not able to find it again, but maybe you can also make a search there.

Andrea
  • 26,120
  • 10
  • 85
  • 131
  • Does that initial receipt include in-app purchases if they where made in a previous installation of the app? I want to use the receipt to check if the user has already enjoyed a trial period, to disable the button. So for example if a user installs the app, "buys" the trial product (non-consumable) and when the trial finishes uninstalls the app, if the user reinstalls the app later (or in another device), will that in-app purchase be present in the receipt without needing a refresh? – ciclopez Jan 13 '19 at 17:17
  • 1
    @ciclopez I don't have a clear answer for that. With auto renewable subscriptions (in my experience), if the user had downloaded the same app with the same account on another device the receipt was there but empty, by tapping on "Restore purchases" the user was able to recover its purchases. But it's been a long time, maybe something has changed. – Andrea Jan 14 '19 at 13:24