I’m having an issue with getting IAP to work properly on iOS. When I use store.purchase(“com.someIAPIDHere”) nothing happens. None of my print statements in my transaction callback are fired. Even if I am not signed in with any Apple Id it does not prompt me for a login. If I use the loadProducts call I can see my IAP listed as valid(there is only 1 IAP item). I based the code off of the IAP demo. In some other apps I used the google play IAP with this code and it worked fine.
Here is what I did on iTunes Connect/Apple dev center. I did this 30+ hours ago so the changes should of propagated through all of apple’s systems by now.
- Created my unique app id
- Created a provisioning profile using the app id
- Created the app in iTunesConnect. The app is currently at Waiting for Review.
- Created the IAP item. The current status is cleared for sale and Waiting for Review
- Created a test user
Here is slimmed down version of my code based off of the IAP demo:
[lua]local store = require(“store”)
function transactionCallback(event)
print(“callback received”)
local transaction = event.transaction
local productId = transaction.productIdentifier
if transaction.state == “purchased” then
print(“purchased”)
–some code here to handle purchase
elseif transaction.state == “restored” then
print(“restored”)
– You’ll never reach this transaction state on Android.
–some code here to handle restore
elseif transaction.state == “refunded” then
print(“refunded”)
elseif transaction.state == “cancelled” then
– Transaction was cancelled; tell you app to react accordingly here
print(“cancelled”)
elseif transaction.state == “failed” then
– Transaction failed; tell you app to react accordingly here
print(“failed”)
end
– The following must be called after transaction is complete.
– If your In-app product needs to download, do not call the following
– function until AFTER the download is complete:
store.finishTransaction( transaction )
end
if store.availableStores.apple then
store.init(“apple”, transactionCallback)
print(“Using Apple’s in-app purchase system.”)
elseif store.availableStores.google then
store.init(“google”, transactionCallback)
print(“Using Google’s Android In-App Billing system.”)
else
print(“In-app purchases is not supported on this system/device.”)
end
function doPurchase()
print(“do purchase”)
store.purchase(“com.mycompany.myapp.myiapid”)
end[/lua]
With the store.init call, at first I just had it as store.init(transactionCallback)
but later switched it to what’s in the code above. I can confirm the I do get the print statement stating it is using apples in app purchase system
I receive the “do purchase” print statement everytime I try to run the purchase however nothing inside the transactionCallback is ever printed. On the device itself nothing happens.
If anyone has seen something similar or has any suggested I’d appreciate it. Somewhat stumped on what to do now :X [import]uid: 147305 topic_id: 35344 reply_id: 335344[/import]