Languages

Menu
Sites
Language
Problem with In App Purchase

Hello, I'm trying to add an In App Purchase system in my game, but I can't get the In App Purchase system to work...
Here is my code (widely inspired from the examples)

   
HashMap pArgList;
pArgList.Construct();

AppControl* pAc = AppManager::FindAppControlN(L"tizeninapp.IapClient", L"http://tizen.org/inapp/purchase");
if (!pAc)
{
NN_LOG("Billing not possible sorry");
return 4;
}

String key_mode = L"_mode";
String val_mode = L"0";

String key_transactionId = L"_transactionId";
String val_transactionId = L"1";

String key_itemId = L"_itemId";
String val_itemId((char*)itemid);

String key_itemGroupId = L"_ItemGroupId";
String val_itemGroupId = L"100000000000";

pArgList.Add(&key_mode, &val_mode);
pArgList.Add(&key_transactionId, &val_transactionId);
pArgList.Add(&key_itemId, &val_itemId);
pArgList.Add(&key_itemGroupId, &val_itemGroupId);

// stage one : initialization
app->waitingForStore = true;
pAc->Start(null, null, &pArgList, app);
while(app->waitingForStore)
{
KC_Sleep(100);
}

if(app->IAPState != APP_CTRL_RESULT_SUCCEEDED)
{
NN_LOG("Problem during first stage of Purchase");
delete pAc;
if(app->IAPState == APP_CTRL_RESULT_CANCELED)
return 2;
else
return 3;
}

<... end of the function ...>

We are here in a worker thread and the listener is the App, which set back the waitingForStore flag to false once the result received.

Does anybody see a mistake ?

Here are the error logs from the begining of the function to the return 3, where the function ends.

ERROR / Tizen::Base ( 8719 : 8719 ) : result Tizen::Base::String::SubString(int, Tizen::Base::String&) const(1112) > [E_OUT_OF_RANGE] The startIndex(47) MUST be greater than or equal to 0, and less than the length of this string(47).
ERROR / Tizen::Base ( 8719 : 8719 ) : result Tizen::Base::String::SubString(int, Tizen::Base::String&) const(1112) > [E_OUT_OF_RANGE] The startIndex(47) MUST be greater than or equal to 0, and less than the length of this string(47).
ERROR / Tizen::Base ( 8719 : 8719 ) : result Tizen::Base::String::SubString(int, Tizen::Base::String&) const(1112) > [E_OUT_OF_RANGE] The startIndex(47) MUST be greater than or equal to 0, and less than the length of this string(47).
ERROR / Tizen::Base::Collection ( 2591 : 2591 ) : virtual const Tizen::Base::Object* Tizen::Base::Collection::ArrayList::GetAt(int) const(241) > [E_OUT_OF_RANGE] The index(2) MUST be greater than or equal to 0 and less than the number of elements(2).
ERROR / Tizen::Base ( 8719 : 8719 ) : result Tizen::Base::String::SubString(int, Tizen::Base::String&) const(1112) > [E_OUT_OF_RANGE] The startIndex(47) MUST be greater than or equal to 0, and less than the length of this string(47).
ERROR / Tizen::Io ( 8719 : 8719 ) : static bool Tizen::Io::File::IsFileExist(const Tizen::Base::String&)(300) > [E_INVALID_ARG] Given filePath length is zero or exceeds system limitations.
ERROR / Tizen::App ( 8719 : 8719 ) : Tizen::Ui::Controls::Frame* Tizen::App::_UiAppImpl::GetFrameAt(int)(415) > [E_OUT_OF_RANGE] The index is greater than the number of frames.
ERROR / Tizen::Ui::Scenes ( 8719 : 8719 ) : result Tizen::Ui::Scenes::_SceneManagerImpl::Construct()(207) > [E_SYSTEM] A system error has been occurred. pUiApp->GetFrameAt(0) return null.
ERROR / Tizen::Base ( 8719 : 8719 ) : result Tizen::Base::String::SubString(int, Tizen::Base::String&) const(1112) > [E_OUT_OF_RANGE] The startIndex(47) MUST be greater than or equal to 0, and less than the length of this string(47).
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::_SimInfoImpl::Construct()(73) > [E_DEVICE_UNAVAILABLE] The operation failed because the SIM card is not ready.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::SimInfo::Construct()(73) > [E_DEVICE_UNAVAILABLE] Propagating.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::_SimInfoImpl::Construct()(73) > [E_DEVICE_UNAVAILABLE] The operation failed because the SIM card is not ready.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::SimInfo::Construct()(73) > [E_DEVICE_UNAVAILABLE] Propagating.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::_SimInfoImpl::Construct()(73) > [E_DEVICE_UNAVAILABLE] The operation failed because the SIM card is not ready.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::SimInfo::Construct()(73) > [E_DEVICE_UNAVAILABLE] Propagating.
ERROR / Tizen::Base ( 8719 : 8719 ) : result Tizen::Base::String::SubString(int, Tizen::Base::String&) const(1112) > [E_OUT_OF_RANGE] The startIndex(47) MUST be greater than or equal to 0, and less than the length of this string(47).
ERROR / Tizen::Base ( 8719 : 8719 ) : result Tizen::Base::String::SubString(int, Tizen::Base::String&) const(1112) > [E_OUT_OF_RANGE] The startIndex(47) MUST be greater than or equal to 0, and less than the length of this string(47).
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::_SimInfoImpl::Construct()(73) > [E_DEVICE_UNAVAILABLE] The operation failed because the SIM card is not ready.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::SimInfo::Construct()(73) > [E_DEVICE_UNAVAILABLE] Propagating.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::_SimInfoImpl::Construct()(73) > [E_DEVICE_UNAVAILABLE] The operation failed because the SIM card is not ready.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::SimInfo::Construct()(73) > [E_DEVICE_UNAVAILABLE] Propagating.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::_SimInfoImpl::Construct()(73) > [E_DEVICE_UNAVAILABLE] The operation failed because the SIM card is not ready.
ERROR / Tizen::Telephony ( 8719 : 8719 ) : result Tizen::Telephony::SimInfo::Construct()(73) > [E_DEVICE_UNAVAILABLE] Propagating.
ERROR / Tizen::Ui::Scenes ( 8719 : 8719 ) : result Tizen::Ui::Scenes::_SceneManagerImpl::GoForward(const Tizen::Ui::Scenes::ForwardSceneTransition&, const Tizen::Base::Collection::IList*)(560) > [E_INVALID_STATE] SceneManager is in an invalid state. Policy provider not registered.
ERROR / Tizen::Ui ( 8719 : 8719 ) : virtual result Tizen::Ui::_ControlImpl::OnAttachedToMainTree()(2454) > [E_SYSTEM] System error occurred.
ERROR / Tizen::Ui::Controls ( 8719 : 8719 ) : virtual result Tizen::Ui::Controls::_FrameImpl::OnAttachedToMainTree()(580) > [E_SYSTEM] Propagating.
ERROR / Tizen::Ui ( 8719 : 8719 ) : result Tizen::Ui::_ControlManager::CallOnAttachedToMainTree(Tizen::Ui::_Control&)(667) > [E_SYSTEM] Propagating.
ERROR / Tizen::Ui ( 8719 : 8719 ) : result Tizen::Ui::_ControlManager::ActivateWindow(Tizen::Ui::_Window&)(587) > [E_SYSTEM] Propagating.
ERROR / Tizen::Ui ( 8719 : 8719 ) : result Tizen::Ui::_ControlManager::OpenWindow(Tizen::Ui::_Window&, bool)(498) > [E_SYSTEM] System Error.
ERROR / Tizen::Base::Collection ( 8719 : 8719 ) : virtual const Tizen::Base::Object* Tizen::Base::Collection::ArrayList::GetAt(int) const(241) > [E_OUT_OF_RANGE] The index(0) MUST be greater than or equal to 0 and less than the number of elements(0).
ERROR / Tizen::Ui::Animations ( 8719 : 8719 ) : virtual Tizen::Ui::Animations::_RootVisualElement::~_RootVisualElement()(60) > [E_INVALID_STATE] The RootVisualElement instance has been destroyed, but the layer information was not cleaned.
ERROR / Tizen::Ui::Animations ( 8719 : 8719 ) : virtual Tizen::Ui::Animations::_RootVisualElement::~_RootVisualElement()(60) > [E_INVALID_STATE] The RootVisualElement instance has been destroyed, but the layer information was not cleaned.
ERROR / Tizen::Base::Collection ( 2591 : 2591 ) : virtual const Tizen::Base::Object* Tizen::Base::Collection::ArrayList::GetAt(int) const(241) > [E_OUT_OF_RANGE] The index(2) MUST be greater than or equal to 0 and less than the number of elements(2).
INFO / hodti ( 8685 : 8701 ) : void mp_printf(const char *, ...)(42) > Problem during first stage of Purchase
 

thanks by advance

Benjamin

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

19 Replies
simoun finch
Hello, Have a look on below link...https://developer.tizen.org/downloads/in-app-purchase Might be you get an overview idea...... In-App applications are always need device to run...i m not sure.....as of my knowledge .........
Benjamin Blois
Thanks for the link but it is from where I took all my infos. From the errors, I can read "The operation failed because the SIM card is not ready." Would it be because I have no SIM card in my phone that the In App Purchase refuses to launch the request (even in developer mode) ?
muditha murthy
It seems when the developer flag is not set you need to have a sim card inside for IAP to work http://developer.samsung.com/forum/thread/strange-behavior-with-in-app-purchases-on-phone-without-simcard-and-android-233/79/231284?boardName=InAppPL&startId=zzzzz~
Mallikarjun Hunalli
1. Developer mode: In this mode, we can select the supported country list and test without SIM card or test in any part of the geographical area. 2. Normal mode: This works only if valid SIM (SIM card from France, Ukrain, Russia and Japan carriers) is present or based on GeoIP (Geogrphical IP – User needs to be present in either France, Ukrain, Russia and Japan). Currently Tizen server is not in many countries. hence while developing and testing use Developer flag. Currently, IAP Store server supported for France, Ukrain, Russia and Japan
Benjamin Blois
It looks like my issue, but for me it's refusing the transaction even when the dev mode flag is set, with the same kind of errors. The error thrown is : " APP_CTRL_RESULT_FAILED : The application operation has failed". The most annoying thing is that Tizen devices do not recognize SIM card yet (at least not mine), so it's hard to test. There are only two solutions : i made a mistake in my program, or there is a bug in the library... Can somebody say for sure if my code is right or not ? Like that if my code is right, I will register the bug to get it fixed asap.
simoun finch
hi, i think this is true....even i also got a device.These are only test device....for that might be SIM not working...
muditha murthy
Even in my test device the sim card won't work.
Benjamin Blois
Ok so as I thought it's not only my phone that's not recognizing the SIM. But the real issue here is how t oget the In App Purchase working in my example ? Do I miss some parameters in my AppControl Call, or is it a bug with the InAppControl package ? In either case there is a problem, in the documentation which is inaccurate or in the package that's malfunctionning, and I'm doing a bug report on that.
john Smith
Hi, To run InApp application, first of all you need to check whether your device able connect internet or not. After that try to run inApp application.
Benjamin Blois
The phone have access to the internet through WIFI (I just checked browsing a web page in the navigator, and pinged Google). But I keep getting the same error : the AppControl call is done right, but the application called (here the IapClient) answer with APP_CTRL_RESULT_FAILED as appControlResult.
Benjamin Blois
By the way, I have some questions on the InAppPurchase module : - Will it always be an autonomous application or will it become something more like a library ? - Is it assumed that the InAppPurchase app is present on end-user devices ? - If not, will the user be asked to download it himself, or is there a way to include it in the app ? In a phrase : how will work the InAppPurchase module on release devices ?
Alan Savage
Are you able to get the IAP samples to work? The native sample does work for me in devmode and I also get those SIM card errors; I haven't tried javascript as yet. Do you have the Tizen Account TPK installed ( I think it is included already in 2.2b, but not in 2.2 ). Do you set the "_mcc" and "_mnc" country code keys in the app control request as mentioned in the IAP read_me.txt and in the (native) sample? It fails in developer mode if you don't set these.
Benjamin Blois
I can gen the list of items in the IAP sample, but I can't get further (I don't remember why, I'll try tomorow). I'm under 2.1, and tried with and without Tizen Accounts TPK : nothing changed. In my example above now, I did not set MCC and MNC, as I don't see why we should need them (and in the doc they are not explicitly added). I'll try to add these as well tomorow, and see. I keep you up to date
Mallikarjun Hunalli
1. Developer mode: In this mode, we can select the supported country list and test without SIM card or test in any part of the geographical area. 2. Normal mode: This works only if valid SIM (SIM card from France, Ukrain, Russia and Japan carriers) is present or based on GeoIP (Geogrphical IP – developer needs to be present in either France, Ukrain, Russia and Japan). Currently Tizen server is not in many countries. Hence use developer flag and test against the country list you receive.
Benjamin Blois
Retried today changing some settings, and it seems to work. thanks for the help !
Stefan
Can you give a little more detail ? I have the same error, the Sample app works, but in my app the SIM error appears. What settings did you change ? Thanks.
Benjamin Blois
Hi Stefan, It was at an early stage of the IAP integration, and so it may have evolved since I used it two month ago, but here 's what I did : As I remember, the problem was with the MCC and MCN that I did not set in the pArgList. Even in developper mode, you must set those. There is default values in the doc will help you, as it was updated to say this while I was working on that. Hope it helps.
Stefan
Thanks for the quick answers. This was my problem to, after setting the mcc and mnc it worked. I did no set them, because the IAP programming guide said this parameters are not mandatory so I figured I'd leave them out.
Benjamin Blois
Same here, (they weren't even listen in the IAP Client Control at the time). I think that on final devices, those will be recuperated automatically from the SIM (which should explain the error message). But since you don't have a valid SIM inside of you're device, they become mandatory.