Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Titanium in-app purchase with ti.storekit - product not found

I have my in-app product all set up for purchase in iTunes Connect via ti.storekit:

enter image description here

My Appcelerator 4.0 app compiles and deploys to my device (dev profile). The ti.storekit is linked to my app and it compiles. It also seems to execute correctly, in terms of no unhandled exceptions. But it is telling me that it can't find my In-App purchase product. I have tried handing "15 Keys" and also "15Keys" to ti.storekit. I wasn't sure which one it wanted (Reference Name or Product ID) - but anyway neither works.

Here's the documentation I've been following.

And here is the function in ti.storekit that produces the error message:

function requestProduct(identifier, success)
{
    Storekit.requestProducts([identifier], function (evt) {
        if (!evt.success) {
            alert('ERROR: We failed to talk to Apple!');
        }
        else if (evt.invalid) {
            alert('ERROR: Invalid product: ' + identifier);
        }
        else {
            success(evt.products[0]);
        }
    });
}

The "else if" line is being executed: alert('ERROR: Invalid product: ' + identifier); What am I doing wrong? Should I be handing it the Reference Name (15 Keys) or the Product ID (15Keys)? And since I have tried both and neither works, how can I troubleshoot this? What am I doing wrong?

EDIT:

I am unclear on 3 things:

1- Should I go into Settings on my ipad and log in to itunes/store with my TEST USER apple sandbox account? I'm unable to do this because it keeps requiring me to enter a credit card. Test credit cards I've used in the past (on other non-iOS systems), such as 4111111111111111 do not work, and I cannot continue and sign in. Not even sure if I'm supposed to do this. If so, what CC credentials can I use? Should I use a REAL CC for this? Based on everything I'm reading in other articles and posts, it says to never link a test account to a CC number...then WHY won't apple let me log in my test user to my apple device (inside Settings) without entering a credit card?

2- I'm not following the steps in https://github.com/appcelerator-modules/ti.storekit/blob/master/ios/example/app.js EXACTLY, because in my app there is nothing to download, nothing to host, etc. In my app, users can buy keys, which are just digital entities in my app -- nothing to download. So I have removed all code/steps that have anything to do with downloading/hosting.

3- Version 1.0.0 of my app is awaiting review in the app store. This version has no ti.storekit and no in-app purchase. Nothing. BUT I'm working on a newer version with all the storekit and in-app purchase stuff in my latest appcelerator 4.0 project. Shouldn't this work in my dev environment, on my connected ipad, in a dev build? The fact that I have 1.0.0 awaiting review, with no storekit stuff, should have nothing to do with my new version in my dev account with storekit, right? Also I am puzzled by this message:

enter image description here

Do I need to submit a new build to Apple before my DEV storekit stuff will work? If so, this seems very strange, as though an app-store release candidate is connected with stuff I have in development in my local environment. Is this message indicating why my dev storekit stuff won't work? My in-app purchase product seems correctly configured, but shouldn't I be able to connect with this in dev/sandbox regardless of the 1.0 app (no storekit) awaiting review in the app store?

Thanks everyone for your help...I must be missing some critical step I'm not seeing.

like image 209
HerrimanCoder Avatar asked Jun 01 '15 04:06

HerrimanCoder


1 Answers

Did you check if you use the Sandbox for testing? https://github.com/appcelerator-modules/ti.storekit/blob/master/ios/example/app.js#L86

And are you aware that you have to sign out of your existing App Store account to test? https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/TestingInAppPurchases.html

You have to use the Product ID (15Keys).

like image 182
Fokke Zandbergen Avatar answered Nov 15 '22 22:11

Fokke Zandbergen