Here's my process for creating a book with free pages and the rest must be bought:
- Create developer & distributor certificates
- Create new app profile and in-app purchase profile on iTunes Connect (upload screenshot, set price tier, etc)
- Create new Test User on iTunes Connect
- Exported for device in Corona using Distributor Ad-Hoc certificate
- Uploaded binary and rejected it
- Synced .app file to iPad
- 3 pages show up for free, fourth says it must be purchased then takes user back to first page with "Purchase Full Version" button
- Enter test user email and password
This error appears:
http://www.gpanimations.com/appleerror.png
I double checked and all the names match, tried a couple different test user accounts, tried developer profile instead of distributor, and nothing.
Have you waited 24 hours since adding the in-app purchase to iTunes Connect?
Yeah, it's been about 36 hours or so.
Alright. All the prerequisite steps you took check out to me, so in order to make further progress you'd need to post your IAP code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
| ----------------------------------
-- In-App area
----------------------------------
local validProducts, invalidProducts = {}, {}
function unpackValidProducts()
print ("Loading product list")
if not validProducts then
native.showAlert( "In-App features not available", "initStore() failed", { "OK" } )
else
for i=1, #invalidProducts do
native.showAlert( "Item " .. invalidProducts[i] .. " is invalid.",{ "OK" } )
end
end
end
function loadProductsCallback( event )
validProducts = event.products
invalidProducts = event.invalidProducts
unpackValidProducts ()
end
function savePurchase(product)
local files = product..".txt"
local path = system.pathForFile( files, system.DocumentsDirectory )
local file = io.open( path, "r" )
if file then
io.close( file )
else
local path = system.pathForFile( files, system.DocumentsDirectory )
local file = io.open( path, "w+b" )
file:write( "1" )
io.close( file )
end
end
function transactionCallback( event )
if event.transaction.state == "purchased" then
if event.transaction.productIdentifier == "com.gpanimations.digitalnurseryrhymes" then
savePurchase("digitalnurseryrhymes")
end
elseif event.transaction.state == "restored" then
if event.transaction.productIdentifier == "com.gpanimations.digitalnurseryrhymes" then
savePurchase("digitalnurseryrhymes")
end
elseif event.transaction.state == "cancelled" then
elseif event.transaction.state == "failed" then
infoString = "Transaction failed, type: ".. event.transaction.errorType.. event.transaction.errorString
local alert = native.showAlert("Failed ", infoString,{ "OK" })
else
infoString = "Unknown event"
local alert = native.showAlert("Unknown ", infoString,{ "OK" })
end
store.finishTransaction( event.transaction )
end
function setupMyStore (event)
store.loadProducts( listOfProducts, loadProductsCallback )
end
--ENDS IN-APP PURCHASE AREA |
I'm assuming you are calling store.init before store.loadProducts, even though I don't see store.init in your code. Other than that, your IAP module seems to just about mimic mine, so I'm not sure what the problem could be. Maybe Apple doesn't activate new IAPs during the weekend/holiday? You're not the first one to have this problem this week.
Just as a sanity check, I went ahead and re-tested my IAP and it still works (though in fairness my App is a released product, which means Apple has signed off on the IAP)
Well, I really appreciate you taking the time to look at the code. I guess for now I'll just keep working on the app content, this was a test to see if the IAP coding would even work. Hopefully I'll figure it out bu the time the app is done.