Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
VikR0001
Visitor

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 3
speechles
Roku Guru

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
Community Streaming Expert

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
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
VikR0001
Visitor

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
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.