Ravindhiran
Ravindhiran

Reputation: 5384

In-App purchase error - consumable you've already purchased this item, but it hasn't been downloaded

I am new in ios developement .I added an in-app purchase to my app, and I get the products data from the appstore successfully. the iap is a consumable.When I call the "addPayment:" method, I get the "Confirm your in-app purchase... [Environment: Sandbox]" question. I click Yes, and then I get a message which says: "You've already purchased this but it hasn't been downloaded. Tap OK to download it now. [Environment: Sandbox]".would be very grateful if anyone had any ideas whats wrong?

Upvotes: 0

Views: 4343

Answers (3)

SwiftArchitect
SwiftArchitect

Reputation: 48514

Have you uploaded content?

This In-App Purchase is not currently available for testing in the sandbox environment because you have chosen to host your content with Apple, but have not delivered your content. Upload your content to test this In-App Purchase in sandbox.

Upvotes: 0

ObjectiveTC
ObjectiveTC

Reputation: 2507

I was in a similar situation; resolved by restarting my iPhone (holding home/power buttons until the white-apple-logo-on-black-background appears).

Specifically, I had non-consumable purchase hosted on Apple's Server. Installed app to iphone5, made purchase. Deleted App, reinstalled in another build, and upon restorePreviouslyPurchasedTransactions, ITunesStore server didn't respond with my hosted-contact productIdentifier. (Although it did respond and restore some other test purchases that were non-hosted). Purchasing the hosted-content item again produced the error "You've already purchased this In-App Purchase but it hasn't been downloaded."; the alert was without an option to download. I found this site, http://support.nimblebit.com/customer/portal/articles/672080-problem-making-in-app-purchase-ios-os-x; restarted my device, and restore now recognizes the previous purchase.

I don't know exactly what triggered this problem, but note that I had been performing extensive testing on the downloading of this hosted-content item, debugging and ending the program before downloads were complete. I had code in place, upon startup, to spot unfinished transactions and finish them. So FinishTransaction was eventually called. At the time of this error, there were no outstanding transactions in the paymentQueue. My only guess is that abruptly killing an app at some point in the download process leaves a flag intact on the device that the item is being downloaded and so is not available to restore, which if this is the case, fortunately gets reset upon restarting the device.

Upvotes: 0

Stunner
Stunner

Reputation: 12194

This happens when the user is making a purchase on something they have already bought. Given that you are working with a consumable, you need to make sure you send a consumption/provisioning request to the Apple purchase servers when you give the user what they bought.

Upvotes: 1

Related Questions