# API: Edit Order Draft

# editOrderDraft

Change draft settings.

# Required parameters

Parameter Description
id Draft ID

# Optional parameters

Parameter Description
module Payment module ID
scenario_id Order Scenario ID
client_id Client ID
confirm Send Confirm Email - use 1 or 0
invoice_generate Generate invoice - use 1 or 0
invoice_info Send Invoice Info To Client - use 1 or 0
affiliate_id Affiliate id to assign this order / referal to

# Request

GET /admin/api.php?api_id=API_ID&api_key=API_KEY&call=editOrderDraft&id=ID

# PHP Samples

$url = 'http://url_to_hb.com/admin/api.php';
$post = [
  'call' => 'editOrderDraft',
  'api_id' => $API_ID,
  'api_key' => $API_KEY,
  'id' => $ID,
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($ch);
curl_close($ch);

$return = json_decode($data, true);
print_r($return);
include 'class.hbwrapper.php';
HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key');
$params = [
  'id' => $ID,
];
$return = HBWrapper::singleton()->editOrderDraft($params);
print_r($return);
/* Use this method to access HostBill api from HostBill modules */
$api = new ApiWrapper();
$params = [
  'id' => $ID,
];
$return = $api->editOrderDraft($params);
print_r($return);

# Response

{
    "success": true,
    "draft": {
        "services": {
            "2": {
                "product_id": "7063",
                "cycle": "Once",
                "parent_id": 0,
                "category_id": "73",
                "domain": "",
                "billingtype": "PrePay",
                "customdata": [],
                "qty": 1,
                "config": [],
                "domainoptions": {
                    "register": "0",
                    "subdomain": "",
                    "owndomain": false,
                    "owndomainwithus": false,
                    "allowownoutside": false,
                    "hostname": false
                },
                "p_options": 0,
                "contract_id": "0",
                "id": "7063",
                "name": "Softaculous NOC - webuzo",
                "_name": "Softaculous NOC - webuzo",
                "category_name": "Software Licenses",
                "_category_name": "Software Licenses",
                "prorata_amount": false,
                "prorata_date": false,
                "order_date": "2021-09-27 05:00:39",
                "price": 1,
                "price_today": 1,
                "recurring": "once",
                "setup": 0,
                "tax": "0",
                "tax_group_id": "1",
                "full_month": 0,
                "period": {
                    "from": "0000-00-00",
                    "to": "0000-00-00"
                },
                "product": {
                    "id": "7063",
                    "category_id": "73",
                    "type": "5",
                    "name": "Softaculous NOC - webuzo",
                    "description": "",
                    "visible": "1",
                    "domain_options": "0",
                    "stock": "0",
                    "qty": "2",
                    "autosetup": "0",
                    "subdomain": "",
                    "owndomain": "0",
                    "owndomainwithus": "0",
                    "tax": "0",
                    "tax_group_id": "1",
                    "upgrades": "",
                    "sort_order": "6",
                    "client_limit": "0",
                    "hostname": "0",
                    "autohostname": "",
                    "username_generation": "",
                    "p_options": "0",
                    "code": "",
                    "contract_id": "0",
                    "layout": "left",
                    "metadata": [],
                    "hash": "160c965e5f629837dd05aa703f427a5d",
                    "rel": "Product",
                    "paytype": "Once",
                    "m_setup": 0,
                    "q_setup": 0,
                    "s_setup": 0,
                    "a_setup": 0,
                    "b_setup": 0,
                    "t_setup": 0,
                    "p4_setup": 0,
                    "p5_setup": 0,
                    "d_setup": 0,
                    "w_setup": 0,
                    "h_setup": 0,
                    "m": 1,
                    "q": 0,
                    "s": 0,
                    "a": 0,
                    "b": 0,
                    "t": 0,
                    "p4": 0,
                    "p5": 0,
                    "d": 0,
                    "w": 0,
                    "h": 0,
                    "m_enabled": "0",
                    "q_enabled": "0",
                    "s_enabled": "0",
                    "a_enabled": "0",
                    "b_enabled": "0",
                    "t_enabled": "0",
                    "p4_enabled": "0",
                    "p5_enabled": "0",
                    "d_enabled": "0",
                    "w_enabled": "0",
                    "h_enabled": "0",
                    "ptype": "Other",
                    "product_id": "7063",
                    "tag_name": "Softaculous NOC - webuzo",
                    "tag_description": "",
                    "category_name": "Software Licenses",
                    "template": "cart_vps",
                    "ctype": "wizard",
                    "slug": "software-licenses",
                    "module": "328",
                    "main": "1",
                    "server": {
                        "536": "536"
                    },
                    "options": {
                        "Product": "Webuzo",
                        "Server IP": "",
                        "The period to renew": "1 month",
                        "Server type": "Dedicated",
                        "E-mail": "",
                        "Auto renew": "Yes",
                        "Virtualizor: Number of VPS": "",
                        "Virtualizor: Type of license": "Premium",
                        "Webuzo: Type of license": "mini_c",
                        "Softaculous: Buy_sitepad": "0"
                    },
                    "modname": "Softaculous NOC",
                    "filename": "class.softaculousnoc.php",
                    "domain_op": [],
                    "free_domain": "0",
                    "emails": {
                        "AfterModuleTerminate": "0",
                        "after_accountinsert": "0",
                        "ClientAfterPackageChangeSuccess": "0",
                        "ProductAccountCreated": "0",
                        "remindNextDueDate": "0",
                        "StaffAfterPackageChangeFailed": "0",
                        "StaffAfterPackageChangeSuccess": "0",
                        "SuspendAccount": "0",
                        "UnsuspendAccount": "0"
                    },
                    "tags": [],
                    "metrics": [],
                    "out_of_stock": false,
                    "service_type": "Hosting",
                    "prices": [
                        {
                            "id": 47439,
                            "rel": "Product",
                            "rel_id": "7063",
                            "type": "m",
                            "price": "1.00"
                        },
                        {
                            "id": 47440,
                            "rel": "Product",
                            "rel_id": "7063",
                            "type": "m_setup",
                            "price": "0.00"
                        },
                        {
                            "id": 47441,
                            "rel": "Product",
                            "rel_id": "7063",
                            "type": "m_upgrade",
                            "price": "0.00"
                        }
                    ],
                    "billingtype": "PrePay",
                    "currency_checked": true
                },
                "category": {
                    "id": "73",
                    "parent_id": "0",
                    "contains": "products",
                    "module": "0",
                    "name": "Software Licenses",
                    "description": "",
                    "visible": "0",
                    "sort_order": "61",
                    "template": "cart_vps",
                    "ctype": "wizard",
                    "ptype": "5",
                    "slug": "software-licenses",
                    "opconfig": [],
                    "scenario_id": "1",
                    "tag_name": "Software Licenses",
                    "tag_description": ""
                },
                "addons": [],
                "customizations": {
                    "2253": {
                        "id": "2253",
                        "type": "input",
                        "required": 0,
                        "name": "Server IP",
                        "key": "",
                        "variable": "serverip",
                        "description": "",
                        "category": "",
                        "product_id": "7063",
                        "copy_of": "2253",
                        "options": 2,
                        "config": {
                            "hidden": false
                        },
                        "sort_order": "1",
                        "group_id": "0",
                        "admin_access": "",
                        "admin_team_access": "",
                        "admin_description": "",
                        "ftype": "input",
                        "configtemplates": {
                            "adminlist": "\/var\/www\/public\/includes\/libs\/configoptions\/adminlist.tpl",
                            "cart": "\/var\/www\/public\/includes\/libs\/configoptions\/input\/cart.tpl",
                            "accounts": "\/var\/www\/public\/includes\/libs\/configoptions\/input\/accounts.tpl",
                            "clientarea": "\/var\/www\/public\/includes\/libs\/configoptions\/input\/clientarea.tpl",
                            "upgrades": "\/var\/www\/public\/includes\/libs\/configoptions\/input\/upgrades.tpl",
                            "clientedit": "\/var\/www\/public\/includes\/libs\/configoptions\/input\/clientedit.tpl"
                        },
                        "_name": "Server IP",
                        "_description": "",
                        "hasQty": false,
                        "typeconf": {
                            "group": "input",
                            "type": "input",
                            "langid": "inputfield",
                            "description": "inputfield-description",
                            "options": [
                                "showcart"
                            ],
                            "info": {
                                "pricing": false,
                                "subitems": false,
                                "data": true,
                                "json": true,
                                "clientedit": true,
                                "searchable": true,
                                "adminaccess": true,
                                "encrypt": false,
                                "multiitems": false,
                                "validation": false,
                                "setval": false
                            },
                            "templates": {
                                "Input Settings": "\/var\/www\/public\/includes\/libs\/configoptions\/input\/settings.tpl"
                            }
                        },
                        "items": {
                            "10793": {
                                "id": "10793",
                                "category_id": "2253",
                                "name": "Server IP",
                                "variable_id": "",
                                "sort_order": "1",
                                "options": 2,
                                "group_id": "0",
                                "copy_of": "10793",
                                "description": "",
                                "rel": "",
                                "paytype": "",
                                "m_setup": "",
                                "q_setup": "",
                                "s_setup": "",
                                "a_setup": "",
                                "b_setup": "",
                                "t_setup": "",
                                "p4_setup": "",
                                "p5_setup": "",
                                "d_setup": "",
                                "w_setup": "",
                                "h_setup": "",
                                "m": "",
                                "q": "",
                                "s": "",
                                "a": "",
                                "b": "",
                                "t": "",
                                "p4": "",
                                "p5": "",
                                "d": "",
                                "w": "",
                                "h": "",
                                "m_enabled": "",
                                "q_enabled": "",
                                "s_enabled": "",
                                "a_enabled": "",
                                "b_enabled": "",
                                "t_enabled": "",
                                "p4_enabled": "",
                                "p5_enabled": "",
                                "d_enabled": "",
                                "w_enabled": "",
                                "h_enabled": "",
                                "_name": "Server IP",
                                "_description": "",
                                "recurring": "free",
                                "price": 0,
                                "setup": 0,
                                "fee": 0,
                                "upgrade_fee": 0,
                                "unit_price": 0,
                                "_price": 0,
                                "_fee": 0,
                                "_setup": 0,
                                "_unit_price": 0,
                                "cycle": "once",
                                "currency_checked": true,
                                "qty": 1,
                                "related_item": 2,
                                "total": 0,
                                "price_today": 0,
                                "prorata_amount": false,
                                "prorata_date": false,
                                "fullname": "Server IP: ",
                                "_fullname": "Server IP: ",
                                "unitprice": 0,
                                "billingtype": "PrePay",
                                "type": "input",
                                "old": [],
                                "full_month": 0,
                                "discount_details": {
                                    "options": 0,
                                    "item_type": "Config",
                                    "item_id": "2253",
                                    "code": "",
                                    "type": "percent",
                                    "value": "10",
                                    "value_renew": "10",
                                    "cycle": "recurring",
                                    "clients": "all",
                                    "expire_days": "",
                                    "expire_at": "",
                                    "rel_type": "Coupon",
                                    "rel_id": "",
                                    "discount": 0,
                                    "recurring_discount": {
                                        "free": 0
                                    },
                                    "currency_checked": true,
                                    "value_id": 10793,
                                    "draft_ref": "services.2.customizations.2253.items.10793"
                                }
                            }
                        },
                        "currency_checked": true,
                        "qty": 1,
                        "data": {
                            "10793": "1.2.3.4"
                        },
                        "values": {
                            "10793": 1
                        },
                        "price": 0,
                        "recurring": [],
                        "total": "0.00",
                        "discount": "0.00",
                        "cost": "0.00"
                    }
                },
                "total": {
                    "total": 1,
                    "recurring": [],
                    "discount": "0.10",
                    "recurring_discount": [],
                    "discount_details": [
                        {
                            "options": 0,
                            "item_type": "Hosting",
                            "item_id": "7063",
                            "code": "",
                            "type": "percent",
                            "value": "10",
                            "value_renew": "10",
                            "cycle": "recurring",
                            "clients": "all",
                            "expire_days": "",
                            "expire_at": "",
                            "rel_type": "Coupon",
                            "rel_id": "",
                            "discount": 0.1,
                            "recurring_discount": {
                                "once": 0.1
                            },
                            "currency_checked": true,
                            "draft_ref": "services.2"
                        },
                        {
                            "options": 0,
                            "item_type": "Config",
                            "item_id": "2253",
                            "code": "",
                            "type": "percent",
                            "value": "10",
                            "value_renew": "10",
                            "cycle": "recurring",
                            "clients": "all",
                            "expire_days": "",
                            "expire_at": "",
                            "rel_type": "Coupon",
                            "rel_id": "",
                            "discount": 0,
                            "recurring_discount": {
                                "free": 0
                            },
                            "currency_checked": true,
                            "value_id": 10793,
                            "draft_ref": "services.2.customizations.2253.items.10793"
                        }
                    ],
                    "cost": "0.90",
                    "setup": 0
                },
                "discount_details": {
                    "options": 0,
                    "item_type": "Hosting",
                    "item_id": "7063",
                    "code": "",
                    "type": "percent",
                    "value": "10",
                    "value_renew": "10",
                    "cycle": "recurring",
                    "clients": "all",
                    "expire_days": "",
                    "expire_at": "",
                    "rel_type": "Coupon",
                    "rel_id": "",
                    "discount": 0.1,
                    "recurring_discount": {
                        "once": 0.1
                    },
                    "currency_checked": true,
                    "draft_ref": "services.2"
                }
            }
        },
        "addons": [],
        "domains": [],
        "customizations": {
            "2": {
                "2253": {
                    "10793": {
                        "val": "1.2.3.4",
                        "qty": 1,
                        "variable": "serverip",
                        "type": "input",
                        "customdata": []
                    }
                }
            }
        },
        "dom_customizations": [],
        "id": 251,
        "client_id": "",
        "module": 0,
        "date": "2021-09-27 05:00:39",
        "discount": [
            {
                "type": "percent",
                "value": "10",
                "cycle": "recurring"
            }
        ],
        "scenario_id": 0,
        "staff_member_id": 0,
        "contract_id": "0",
        "commitment_date": "",
        "affiliate_id": 0,
        "metadata": {
            "recipients": []
        },
        "estimate_id": "0",
        "options": {
            "confirm_email": true,
            "generate_invoice": true,
            "send_invoice": true,
            "override_recipients": false
        },
        "available_recipients": [
            []
        ],
        "price": {
            "total": "1.00",
            "recurring": [],
            "discount": "0.10",
            "recurring_discount": [],
            "discount_details": [
                {
                    "options": 0,
                    "item_type": "Hosting",
                    "item_id": "7063",
                    "code": "",
                    "type": "percent",
                    "value": "10",
                    "value_renew": "10",
                    "cycle": "recurring",
                    "clients": "all",
                    "expire_days": "",
                    "expire_at": "",
                    "rel_type": "Coupon",
                    "rel_id": "",
                    "discount": 0.1,
                    "recurring_discount": {
                        "once": 0.1
                    },
                    "currency_checked": true,
                    "draft_ref": "services.2"
                },
                {
                    "options": 0,
                    "item_type": "Config",
                    "item_id": "2253",
                    "code": "",
                    "type": "percent",
                    "value": "10",
                    "value_renew": "10",
                    "cycle": "recurring",
                    "clients": "all",
                    "expire_days": "",
                    "expire_at": "",
                    "rel_type": "Coupon",
                    "rel_id": "",
                    "discount": 0,
                    "recurring_discount": {
                        "free": 0
                    },
                    "currency_checked": true,
                    "value_id": 10793,
                    "draft_ref": "services.2.customizations.2253.items.10793"
                }
            ],
            "cost": "0.90",
            "setup": 0,
            "total_cost": 0.9
        },
        "currency": {
            "code": "USD",
            "iso": "USD",
            "sign": "$",
            "format": "1,234.56",
            "decimal": "2",
            "rounding": "2",
            "rounding_mode": "HALF_UP",
            "id": 0,
            "rate": 1
        }
    },
    "call": "editOrderDraft",
    "server_time": 1737627314
}
Last Updated: 1/27/2025, 4:41:21 PM