Skip to content

Option_Create

Jacob McConnell edited this page Jun 11, 2014 · 2 revisions

You must specify your API username and password when creating your 2checkout-node object (named ‘tco’ in these examples) before calling this method.

##Method

###create

Use to create an option.

####Arguments

  • object - Object containing option parameters. Parameters -> API Create Option
  • callback - Function to be called on success/error

####Returns

Response Object

####Example Usage:

args = {
    option_name: "test option",
    option_value_name: "value name",
    option_value_surcharge: "0.01"
};

tco.productOptions.create(args, function (error, data) {
    if (error) {
        console.log(error);
    } else {
        console.log(data.response_code);
    }
});

####Example Response:

{
    "option_id": "1234567890",
    "response_code": "OK",
    "response_message": "Option created successfully"
}
Clone this wiki locally