Solved

Checking for products eligibility may trigger AppStore sign-in

  • 10 August 2021
  • 2 replies
  • 40 views

Badge

Hi,

We’re going to add introuctory offers to some products in our iOS app. And we want to make sure we display the right choise for each user depending on their receipts. So it looks like we could achieve this by using  checkTrialOrIntroductoryPriceEligibility

However, because it could result into refreshing user’s receipt, the AppStore sign-in dialog may appear. As I see from the current logic in the SDK it happens only when the receipt is missing in the app bundle. Which shouldn’t be the case for AppStore build. Though it’s a usual case for development and sandbox builds. Particularly the dialog appears if I try to call this method when there’s no sandbox user logged into device AppStore.

Thus we have a concern about prompting AppStore sign-in dialog unexpectedly in the process of Apple review causing a rejection. Mainly this post is the source of my concerns. And also this recommendation from Apple: 

The application can advise the user that the appStoreReceipt appears to be outdated and may require refreshing

So it looks like we should precede the call to checkTrialOrIntroductoryPriceEligibility  with a user message about what is going to happen. Otherwise the AppStore sign-in will look suspiciously. Is my understanding correct?

Also it looks like this message will appear only for sandbox users (and Apple reviewers). Do you know in which cases the receipt might be missing in AppStore build?

Considering all of the above do you think it makes sense to provide a way to check for product eligibility without refreshing the receipt? That is the check could be made silently and if no receipt found locally it results in unknown status.

 

Thank you.

icon

Best answer by cody 10 August 2021, 22:11

View original

2 replies

Userlevel 3
Badge +7

Hey @Viktor!

Your understanding is correct- this will only occur in sandbox, as there is not a receipt available in sandbox until a purchase has been made. In production, a receipt should always be available, even if no in-app purchases have been made. There is additional metadata stored in the receipt that is available after downloading an app from the App Store that isn’t included in sandbox mode.

I also understand that the word ‘should’ leaves some unknown wiggle room 😅 I can’t say there can never be an edge case where a receipt might be missing in production, but it really shouldn’t ever happen. I sent this over to our SDK team as a feature request, so it’s on the backlog now to include a way to not force refresh a receipt if you don’t want it to.

In the meantime, if you need to be sure that the checkTrialOrIntroductoryPriceEligibility method is never called when a receipt isn’t on device, especially when submitting your app for review, you can check if a receipt exists manually before calling that method:

if let receiptURL = Bundle.main.appStoreReceiptURL,  let _ = try? Data(contentsOf: receiptURL) {
// receipt data found, call checkTrialOrIntroductoryPriceEligibility
}
else {
// no receipt data
}

 

Badge

Thanks @cody for confirming my understanding and for the suggested workaround as well. We’ll be looking forward to see the changes in the next versions of SDK.

 

Best regards.

Reply