Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if user has already downloaded non-consumable item Inapp purchase

I am providing non-consumable item in my application.

suppose user purchases that item and tries to install that application on another device with same id . If the user is logged in and already have purchased that item , i want to show some pop up and tell user that you have already purchased it so download it for free now.what happens right now is , when i click to purchase item again then is says that u have already purchased that item click to download.

Is there any way to get user login details and check if user has already made In-app purchase or not.

there is a problem when i login and try to buy already purchased item . two kinds of alert view appears time to time . i am using sandbox environment.

  1. you've already purchased this but it hasn't been downloaded.Tap OK to download it now. this alert view has only OK button .when we press Ok control goes to - (void)failedTransaction:(SKPaymentTransaction *)transaction

  2. you've already purchased this.Tap OK to download it again for free.this alert view has two button one is Cancel and another is OK . On pressing OK button control goes to - (void)completeTransaction:(SKPaymentTransaction *)transaction which is fine.

An idea why transaction is showing this peculiar behavior .

thanks

like image 845
rocksvick Avatar asked May 03 '12 05:05

rocksvick


1 Answers

I don't understand why you think you need to do anything different.

As you said, the system detects that the user already owns the product, and gives the user a “click to download” alert. If the user chooses to download, then you get an SKPaymentTransaction whose state is either “purchased” or “restored” (I forget which). Then you just provide the product as usual. So the user knows that he's not being charged a second time, and he gets the product.

If you're saying you want to automatically detect what products the user owns, without the user having to do anything: you can only do that by sending restoreCompletedTransactions to the SKPaymentQueue. When you do that, the user may have to enter his iTunes password. I prefer to just have a “restore purchases” button in my UI, so the user knows why he's being asked for his password.

like image 96
rob mayoff Avatar answered Oct 23 '22 23:10

rob mayoff