Your Digital Media Has Never Looked So Good

 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

roChannelStore/billing docs = ancient & incorrect

Tue Jul 05, 2016 2:31 am

After trying to use it, turns out the docs on Roku Billing Services are years behind the implementation. Which is out-of-this-world, because if an API is un/under/wrong-documented, it is unusable. How can dev.blog recently promote Roku's billing services with a straight face?!

Most problematic is ifChannelStore, talking about non-existing fields like SDPosterUrl, HDPosterUrl, description - while missing others. Neighboring pages also have issues, e.g. roChannelStore has an old version of "Web Service API" shoveled into it - but now there is a separate page named "Web Service API" (i did not scrutinize these but is confusing to have 2 different sources for the same info and i bet one of them is less correct).

To lend a hand in (hopefully) fixing that page - and as note-to-self - here is what different functions (async)return in real world these days:
GetCatalog() wrote:
[{
code: "raga-no-ads"
cost: "$1.99"
freeTrialQuantity: 0 ' ^
freeTrialType: "None"
name: "blah de blah"
productType: "NonConsumable"
purchaseDate: "0001-01-01T00:00:00"
qty: 1
}]

getOrder() after setOrder([{code:"raga-no-ads", qty:1}]) wrote:
[{
code: "raga-no-ads"
freeTrialQuantity: 29
qty: 1
}]

canceled doOrder() wrote:
= false
e.isRequestInterrupted = true
e.getStatus() = 2
e.getStatusMessage() = "Order Received"
[{
amount: "$1.99"
code: "raga-no-ads"
description: "blah de blah"
freeTrialQuantity: 232 'NB. value varies, seems random!
name: "blah de blah"
qty: 1
total: "$1.99"
}]

doOrder() done, test user wrote:
[{
amount: "$0.00"
code: "raga-no-ads"
freeTrialQuantity: 1644301318 'NB. value varies!^^
purchaseId: "xxxxxxxx-cc06-46dc-8b75-a63azzzzzzzz"
qty: 1
total: "$0.00"
}]

failed doOrder() wrote:
= false
e.getStatus() = -3, .getStatusMessage() = "Order Failed" ' on duplicate order
| e.getStatus() = 0, .getStatusMessage() = "Network Down"
[ ]

getPurchases() wrote:
[{
code: "raga-no-ads"
cost: "$1.99" ' buggy ^^^
freeTrialQuantity: 0
freeTrialType: "None"
name: "blah de blah"
productType: "NonConsumable"
purchaseDate: "2016-07-05T07:32:14"
purchaseId: "xxxxxxxx-cc06-46dc-8b75-a63azzzzzzzz"
qty: 1
}]


Also note that doOrder():
  • when user-canceled, returns a misleading roChannelStoreEvent, as if it were completed okay
  • doOrder() on already purchased item shows "Item has already been purchased. This item has already been purchased for this account.", then returns false and event.getResponse() = [ ]
  • doOrder() on already purchased qty:1, this time for qty:2 shows "Order Problem. There was a problem placing your order (error code 006).", then returns false and event.getResponse() = [ ]

(^) I am rather unclear about freeTrialQuantity, freeTrialType, purchaseDate, qty - as to why they are in the catalog and what the meaning might be. The presence of the "red items" seems questionable altogether
(^^) freeTrialQuantity value jumps seemingly randomly - smell of corrupted memory (uninitialized/overflow/dangling pointer?)
(^^^) Notice there is a bug in the `cost` returned by getPurchases() - it does not show the actual amount paid (e.g. test user pays 0 but it will still show $1.99) nor does it show the price at the time of purchase. Instead it shows the current price. E.g. say customer purchased item before for $5 but today it's on sale for $1; getPurchases() will show the past transaction with today's $1 price.
Last edited by EnTerr on Tue Jul 12, 2016 11:22 pm, edited 2 times in total.
 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: roChannelStore/billing docs = ancient & incorrect

Mon Jul 11, 2016 11:52 am

Here is one more problematic spot:
doOrder() wrote:
... If the user approves the order, this function returns true. Otherwise it returns false. In the case that the user approves^, the channel should wait for and respond to^^ the roChannelStoreEvent.isRequestSucceeded event to get the details of the completed transaction.

From my experience using the API so far, there are 2 issues in that statement, which i highlighted:

(^^) There is no way to "respond" to a roChannelStoreEvent. As worded it may leave wrong impression txn is not completed until app consumes the event. Not the case - it's just there is an event "clogging" the port - and also it's generally expected one to check details from the txn.

(^) There will be an event waiting regardless if doOrder() returns true or false. So that event has to be "drained" from the queue or you'll run out-of-sync with the next roChannelStore operation (e.g. getPurchases())
 
User avatar
RokuTomC
Posts: 83
Joined: Wed May 18, 2016 2:59 am

Re: roChannelStore/billing docs = ancient & incorrect

Thu Jul 14, 2016 10:00 am

Hi Enterr, we introduced a SceneGraph ChannelStore node in OS 7.2 which is a bit of a refresh on roChannelStore. Why don't you take a look and let us know what you think?

Docs: https://sdkdocs.roku.com/display/sdkdoc/ChannelStore
Overview blog post: https://blog.roku.com/developer/2016/07 ... ing-guide/
 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: roChannelStore/billing docs = ancient & incorrect

Thu Jul 14, 2016 11:35 am

RokuTomC wrote:
Hi Enterr, we introduced a SceneGraph ChannelStore node in OS 7.2 which is a bit of a refresh on roChannelStore. Why don't you take a look and let us know what you think?

Hey RokuTomC - welcome to the forum!

Afraid i am not in position to take the "SG" pill on this. I am doing a hybrid (w/NDK) app and SG is not going to go well with that, now would it?

Thinking of it, there being 3 distinct interfaces to billing ("classic" roChannelStore, via NDK and now the "du jour" Node) - these are just thin veneers over the web services, right. So i imagine you are keeping them cohesive/coherent?
 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: roChannelStore/billing docs = ancient & incorrect

Fri Aug 12, 2016 2:25 pm

Meanwhile, seems the latest&greatest "ChannelStore" SG is DoA (dead-on-arrival), have a look at https://forums.roku.com/viewtopic.php?f=34&t=96119 
 
bosborne
Posts: 141
Joined: Wed Jun 06, 2012 10:42 am

Re: roChannelStore/billing docs = ancient & incorrect

Sun Sep 04, 2016 4:21 pm

Oof, It would be really great if Roku could make sure the docs are updated, especially for something as critical as billing APIs. 

Who is online

Users browsing this forum: No registered users and 5 guests