语言

Menu
Sites
Language
In-App Purchase. Need help.

I use the code below. I can't reach any of these nasted logs. Console says:

Create InAppPurchaseManager constructor
VM47:1 getItemList() entered
VM47:1 startNumber : 1
VM47:1 mode : IAP_SUCCESS_TEST_MODE
VM47:1 type : ALL

That's all. I figure that may cause that I don't have IAP Library, but I couldn't find any. Only IAP5Helper for Android in the samsples! The sample for Tizen doesn't contain the library!

What the hell? How to manage it?

function successCallback(result) {
       if (result._items.length === 0){
	      console.log("No item");
	   }
	   else {
	      for (var i = 0; i < result._items.length; i++) {
	         console.log("Item ID: " + result._items[i].mItemId);
	         console.log("Item Name: " + result._items[i].mItemName);
	         console.log("Item Price: " + result._items[i].mItemPrice);
	      }
	   }
	}
	
	function errorCallback(error) {
	   console.log(error.name + " : " + error.message);
	}
	
	webapis.inapppurchase.getItemList(1, 15, "ALL", "IAP_SUCCESS_TEST_MODE", successCallback, errorCallback);

 

编辑者为: Anonymous 03 5月, 2019

响应

8 回复
André Reus

Please add privilege if you already not ... 

<tizen:privilege name="http://tizen.org/privilege/billing"/>

Some usefull resources

http://img-developer.samsung.com/onlinedocs/gear/Extension_PG_Web/html/prog_guide/inapp_ww.htm

http://developer.samsung.com/iap/developer-api

That's the link I got that code from!

I did everything as API says!

- I added all the privileges.

- I added items thought the Samsung Seller Office for that application.

- I used the Sample.

- I made my own app using API

Maybe I have incorrect understanding of 

webapis.inapppurchase.getItemList(1, 15, "ALL", "IAP_SUCCESS_TEST_MODE", successCallback, errorCallback);

Must I see any other result beside:

Create InAppPurchaseManager constructor
VM47:1 getItemList() entered
VM47:1 startNumber : 1
VM47:1 mode : IAP_SUCCESS_TEST_MODE
VM47:1 type : ALL

function successCallback(result) {
       if (result._items.length === 0){
	      console.log("No item");
	   }
	   else {
	      for (var i = 0; i < result._items.length; i++) {
	         console.log("Item ID: " + result._items[i].mItemId);
	         console.log("Item Name: " + result._items[i].mItemName);
	         console.log("Item Price: " + result._items[i].mItemPrice);
	      }
	   }
	}
	
	function errorCallback(error) {
	   console.log(error.name + " : " + error.message);
	}
	
	webapis.inapppurchase.getItemList(1, 15, "ALL", "IAP_SUCCESS_TEST_MODE", successCallback, errorCallback);

To my mind it MUST reach any of those nasted LOGS to show me result._items.length either is 0 or >0

Instead that I have nothing!

André Reus

You haven't registered as commercial developer to use IAP...this is one thing ... my another confusion is either the code is buggy or depricated . Because currently tizen's api is like this tizen.system.someFunction()...previously which was like webapis.system.someFunction()...This IAP example is like older style .. 

I registered as a commercial developer (I have paid apps on the store).

I got that code from Samsung IAP-Guide.

If you have another link with new API, please, share. Thanks!

I registered as a commercial developer (I have paid apps on the store).

I got that code from Samsung IAP-Guide.

If you have another link with new API, please, share. Thanks!

André Reus

I am also struggling to find it ... if i find i will share it with you 

I solved the issue.

In App Purchase can not work on emulators and watches that paired with iPhones.

Now those methods work well, but I have another issue. Please, take a look:

https://developer.tizen.org/forums/web-application-development/how-find-out-whether-customer-cancels-subscription-and-refunds-items-app-purchase-gear-mpurchasedate