Jump to content

Adding multiple config options to a product with API AddOrder


Bruce

Recommended Posts

Hi there - I'm struggling to understand the relationship between "1" and 999 below in 'configoptions' - what specifically does the "1" and the 999 reference? If I wanted to add 2 config options to a single product (say 123 and 456) - what would the below configoptions line change to?
 

http_build_query(
        array(
            'action' => 'AddOrder',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
            'password' => 'SECRET_OR_HASHED_PASSWORD',
            'clientid' => '1',
            'pid' => array(1,1),
            'domain' => array('domain1.com', 'dómáin2.com'),
            'idnlanguage' => array('', 'fre'),
            'billingcycle' => array('monthly','semiannually'),
            'addons' => array('1,3,9', ''),
            'customfields' => array(base64_encode(serialize(array("1" => "Google"))), base64_encode(serialize(array("1" => "Google")))),
            'configoptions' => array(base64_encode(serialize(array("1" => 999))), base64_encode(serialize(array("1" => 999)))),
            'domaintype' => array('register', 'register'),
            'regperiod' => array(1, 2),
            'dnsmanagement' => array(0 => false, 1 => true),
            'nameserver1' => 'ns1.demo.com',
            'nameserver2' => 'ns2.demo.com',
            'paymentmethod' => 'mailin',
            'responsetype' => 'json',
        )
    )

dsdsds 

Link to comment
Share on other sites

Here are the config options I specifically want to add as quantity: 1:

 "configoptions": {
                    "configoption": [
                        {
                            "id": 866,
                            "option": "Add-on 1 of 2",
                            "type": "quantity",
                            "value": 0
                        },
                        {
                            "id": 865,
                            "option": "Add-on 2 of 2",
                            "type": "quantity",
                            "value": 0
                        },

It seems it works to add 1, with the serialized array as: a:1:{i:855;i:1;} or a:1:{i:856;i:1;} - as soon as I try add both with a:2:{i:855;i:1;i:856;i:1;} it adds neither??

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated