Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
iOS in App Purchasing First Attempt and First Problem — Gideros Forum

iOS in App Purchasing First Attempt and First Problem

edited September 2012 in General questions
Hi All,
We are implementing the inapp purchase in our game, but when
we tried to test it failed with the message "Product Not Avilable in the
Store".
We know that we do not have to log with the TEST USER made in itunes connect, so when we try to simulate the purchasing we are not requested to log with an account. So something is wrong...

We are pretty much sure we have put all the Bundle ID and Product information correctly, but something is not workin properly over there...
«1

Comments

  • We did it all...Do we need to SUBMIT the App and the Item? I dont think so ? :)
  • I think we need to submit the app and the item first. That's what I've done for my 2 released apps. I haven't experimented other ways.
  • Submitting doesen't mean sen dit for Appstore right?
  • No, it just meant we have to create the app on itunesconnect and also create the item there. We used test account in sandbox mode,
  • edited September 2012
    Yes we are doin that

  • Ye thanks we did all...I think we are missing something in the LUA code tough

    Dislikes: Nascode

    +1 -1 (+0 / -1 )Share on Facebook
  • atilimatilim Maintainer
    edited September 2012 Accepted Answer
    Testing IAP is a little bit tricky. Here are my steps and checklist while implementing IAP:

    1. Test on real device.
    2. Don't use jailbroken device.
    3. If you're using Gideros Player, make sure Bundle ID of player matches your App ID. (appname-info.plist > Bundle Identifier)
    4. Create a test user (iTunes Connect > Manage Users > Test User) and use it as store account. Preferably, while creating the test user, use an email account specifically created for this purpose (e.g. testiap@twelve...com). Also while creating, select iTunes Store same with your country (e.g. Italy)
    4. Login with your newly created account on your device. After logged in, you should enter all your info (name, address, credit card).
    5. After adding your app (iTunes Connect > Manage Your Applications > Add New App), go to "Manage In-App Purchases" and create some. My test bundle ID is com.giderosmobile.iaptest therefore I've created 2 in-app purchases as com.giderosmobile.iaptest.consumable and com.giderosmobile.iaptest.nonconsumable. I'm attaching a screenshot.
    6. The contract for paid applications must be in effect in order to receive data about the in app purchases configured.

    And this is my test code (almost taken from reference manual)
    require "storekit"
     
    local function onRequestProductsComplete(event)
        if event.errorCode ~= nil then
            print("error", event.errorCode, event.errorDescription)
            return
        end
     
        print("products:")
        for i=1,#event.products do
            print("title", event.products[i].title)
            print("description", event.products[i].description)
            print("price", event.products[i].price)
            print("productIdentifier", event.products[i].productIdentifier)
        end
     
        print("invalidProductIdentifiers:")
        for i=1,#event.invalidProductIdentifiers do
            print(event.invalidProductIdentifiers[i])
        end
    end
     
    local function onTransaction(event)
        print("payment.productIdentifier", event.payment.productIdentifier)
        print("payment.quantity", event.payment.quantity)
     
        print("transaction.state", event.transaction.state)
     
        if event.transaction.state == StoreKit.FAILED then
            print("error", event.errorCode, event.errorDescription)
        else        
            print("transaction.identifier", event.transaction.identifier)
            print("transaction.date", event.transaction.date)
     
            if event.transaction.state == StoreKit.PURCHASED then
                print("transaction.receipt", event.transaction.receipt)
            end
     
            if event.transaction.state == StoreKit.RESTORED then
                print("originalTransaction.identifier", event.originalTransaction.identifier)
                print("originalTransaction.date", event.originalTransaction.date)
            end
     
            -- unlock the functionality purchased by the user
        end
     
        storekit:finishTransaction(event.transaction)
    end
     
     
    storekit:addEventListener(Event.REQUEST_PRODUCTS_COMPLETE, onRequestProductsComplete)
    storekit:addEventListener(Event.TRANSACTION, onTransaction)
     
     
    storekit:requestProducts({
    	"com.giderosmobile.iaptest.consumable",
    	"com.giderosmobile.iaptest.nonconsumable",
    })
     
    stage:addEventListener(Event.MOUSE_DOWN, function()
    	storekit:purchase("com.giderosmobile.iaptest.consumable", 1)
    end)
    And here is the output of requestProducts.
    products:
    title	Consumable
    description	Consumable description...
    price	0.99
    productIdentifier	com.giderosmobile.iaptest.consumable
    title	Non-Consumable
    description	Non-Consumable description...
    price	1.99
    productIdentifier	com.giderosmobile.iaptest.nonconsumable
    invalidProductIdentifiers:
    And here is the output of my purchase:
    payment.productIdentifier	com.giderosmobile.iaptest.consumable
    payment.quantity	1
    transaction.state	purchased
    transaction.identifier	1000000055987171
    transaction.date	2012-09-17 13:46:32
    transaction.receipt	{
    	"signature" = "AllZvKkPYAG4cOJHYp1+vaT7XkolcisEpErVty3+LpefQreROWtqJu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AxMDo0NjozMiBFdGMvR01UIjsKfQ==";
    	"environment" = "Sandbox";
    	"pod" = "100";
    	"signing-status" = "0";
    }
    iaps.png
    1023 x 653 - 105K

    Likes: mertocan

    iaps.png 105.1K
    +1 -1 (+1 / -0 )Share on Facebook
  • atilimatilim Maintainer
    And I've done my tests on iPod 2nd gen (iOS 4.2.1) and iPod 4th gen (iOS 5.1.1).
  • From my experience:

    No need to register full information for the test account. Just use it directly when the game ask. In order to do so, we have to log out of our real account first, and don't log in with the test account in phone's setting page.

    Likes: atilim

    +1 -1 (+1 / -0 )Share on Facebook
  • atilimatilim Maintainer
    edited September 2012
    @phongtt oh I see. thanks for the tip :) (If you login from Settings > Store > Sign In, you need to enter full user info to continue.)
  • alexzhengalexzheng Guru
    edited September 2012
    where and how to save the purchased products is safe?
  • We still get INVALID IDENTIFIER...
  • phongttphongtt Guru
    edited September 2012
    Mmm...

    - Are you testing on jailbroken device?
    - What's the status of your IAP item in iTunesConnect?
    - Do you have clearer error description of the issue?
  • - Are you testing on jailbroken device?

    NO

    - What's the status of your IAP item in iTunesConnect?

    Ready to Submit

    - Do you have clearer error description of the issue?

    When we press, it go to connect to the store and the the Invalid identifier with the iap name
  • atilimatilim Maintainer
    edited September 2012
    Did you create your test user and are you using it at iTunes Store?

    btw, as a final solution, I can recommend installing a fresh iOS to your test device. Btw, do you have more than one test device? Do you get the same error for each of them?
    testuser.png
    1017 x 391 - 26K
  • Yes I'm using the test user, we have several iOS devices, but not tested on others tough.
  • mertocanmertocan Member
    edited September 2012
    Same error I have. I spent my all day but I couldn't find the solution.

    products:
    invalidProductIdentifiers:
    com.renklihayatlar.renklihayatlar.nonconsumable2
    payment.productIdentifier com.renklihayatlar.renklihayatlar.nonconsumable2
    payment.quantity 1
    transaction.state failed
    error 0 Can not connect to iTunes Store.
  • atilimatilim Maintainer
    @mertocan If it's ok for you, can you give a temporary password to your test user and PM me:
    1. Test user login/password
    2. Your application bundle ID
    3. Your product IDs

    And although I'm not exactly sure, your bundle ID and product IDs should be compatible. I mean if your bundle ID is com.giderosmobile.myapp, your product IDs should be like com.giderosmobile.myapp.XXX.
  • mertocanmertocan Member
    edited September 2012
    Bundle ID and product ID is compatible. I dont know where is the problem now :S Product Status is ready to Submit. Project Status is prepare for Upload
  • atilimatilim Maintainer
    I've got your PM.

    I can get your product list and make a purchase without a problem. I've only changed the bundle ID of player and deployed to device. And then use the example code above. I cannot predict what's wrong on your side.

    Today I'll install Xcode 4.5 and make a test on iOS 6 also.
  • atilimatilim Maintainer
    On the other hand, storekit.mm plugin is a basic Lua wrapper around StoreKit class. If you get invalidProductIdentifiers then something is wrong about your configuration.
  • I think so. Okay I will check it thanks alot :)
  • is this compulsory we can not use jailbroken device with the above code i even can not get the list of products on the function onRequestProductsComplete was this my mistake or because of jb device?
  • atilimatilim Maintainer
    if you use a jb device, you cannot even get the product list.
  • if you use a jb device, you cannot even get the product list.
    ohhh no let me restore the device and thnx for info

    :)
  • ok now i have normal device and i still can not get the list of products actually i get #event.products = 0


    also when i tap on the screen i get

    event.errorDescription = "can not connect to itunes store"
    and event.error code = 3

    from onTransaction function. what does this mean server down?
  • ok its working now i had the issue no 6

    "The contract for paid applications must be in effect in order to receive data about the in app purchases configured."

Sign In or Register to comment.