Forum Discussion

VikR0001's avatar
VikR0001
Visitor
7 years ago

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!

3 Replies

  • 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.
  • renojim's avatar
    renojim
    Community Streaming Expert
    "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
  • renojim:

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

    That was it. Thanks very much!