Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
VikR0001
Level 7

DoOrder() Error, "min 1 max 2 items in order"?

I'm getting an error on a call to DoOrder(): 


FailureCode -4,
Msg: "min 1 max 2 items in order".

Here's the code that calls DoOrder():


    m.channelStore.SetMessagePort(port)
    m.channelStore.ClearOrder()
    m.channelStore.SetOrder([{
        guid : "PAID.099"
        qty  : 1
    }])
    m.channelStore.DoOrder()
    msg = invalid
    while type(msg) <> "roChannelStoreEvent"
        msg = Wait(0, port)
    end while


I have confirmed that "PAID.099" is the *Identifier/internal reference number" of an in-channel product in this channel. It has  purchase type of "One Time Purchase, Consumable - Quantity 1".

How can I correct this error?

Thanks very much in advance to all for any info!
0 Kudos
3 Replies
speechles
Level 7

Re: DoOrder() Error, "min 1 max 2 items in order"?

myOrder = CreateObject("roSGNode", "ContentNode")
myFirstItem = myOrder.createChild("ContentNode")
myFirstItem.addFields({ "guid": "PAID.099", "qty": 1})
m.channelStore.order = myOrder


Order isn't an roarray, it is a content node with children, like above.
0 Kudos
renojim
Level 8

Re: DoOrder() Error, "min 1 max 2 items in order"?

"speechles" wrote:
Order isn't an roarray, it is a content node with children, like above.

I don't know about that.  I think the problem is he should be using code, not guid.  Here's how I do it (leaving out the SG stuff):
channelStore = CreateObject("roChannelStore")
code = "mycode"
port = CreateObject("roMessagePort")
channelStore.SetMessagePort(port)
order = [{code: code, qty: 1}]
channelStore.SetOrder(order)
result = channelStore.DoOrder()

-JT
0 Kudos
VikR0001
Level 7

Re: DoOrder() Error, "min 1 max 2 items in order"?

renojim:

I think the problem is he should be using code, not guid. 

That was it. Thanks very much!
0 Kudos