Language

2Checkout Documentation

List Options

The list_options call is used to retrieve list of all options in the account.

URL: https://www.2checkout.com/api/products/list_options

HTTP Method: GET


Input Parameters

Parameter Description
option_name Filter list results by option name. Optional.
option_value_name Filter list results by option value name. Optional.
cur_page The page number to retrieve. First page = 1. Optional.
pagesize Total rows per page. Possible values are 1-100. If pagesize not specified, default of 20 items per page will be assigned internally. Optional.
sort_col The name of the column to sort on. Possibile values are option_id and option_name. (case insensitive) Optional.
sort_dir The direction of the sort process. (‘ASC’ or ‘DESC’) (case insensitive) Optional.

Data Returned

options

Parameter Description
option_id System Option ID
option_name Option name
option_values
Parameter Description
option_id System Option ID
option_value_id System Option ID
option_value_surcharge Option value surcharge
option_value_name Option value name
option_name Option name

Example API Call

Twocheckout::username('APIuser1817037');
Twocheckout::password('APIpass1817037');


$result = Twocheckout_Option::retrieve();
Twocheckout::API.credentials = { :username => 'APIuser1817037', :password => 'APIpass1817037' }

option_list = Twocheckout::Option.list()
args = {};

tco.productOptions.retrieve(args, function (error, data) {
    if (error) {
        console.log(error);
    } else {
        console.log(data.response_code);
    }
});
twocheckout.Api.credentials({'username':'APIuser1817037', 'password':'APIpass1817037'})

option_list = twocheckout.Option.list()
var ServiceObject = new OptionService();
var result = ServiceObject.List();
HashMap params = new HashMap();
params.put("pagesize", "3");

OptionList result = TwocheckoutOption.list(params);
curl -G https://www.2checkout.com/api/products/list_options \
    -H 'Accept: application/json' -u 'username:password' \
    -d 'sort_col=option_name' -d 'sort_dir=desc'

Example Successful Response

    {
       "options" : [
          {
             "option_id" : "4688550010",
             "option_name" : "Volume",
             "option_values" : [
                {
                   "option_value_id" : "4688550013",
                   "option_value_name" : "Low",
                   "option_value_surcharge" : "1.00"
                },
                {
                   "option_value_id" : "4688550016",
                   "option_value_name" : "Medium",
                   "option_value_surcharge" : "2.00"
                },
                {
                   "option_value_id" : "4688550019",
                   "option_value_name" : "High",
                   "option_value_surcharge" : "3.00"
                }
             ]
          }
       ],
       "page_info" : {
          "cur_page" : "1",
          "first_entry" : 1,
          "first_page" : 1,
          "first_page_url" : "https://www.2checkout.com/api/products/list_options?cur_page=1",
          "last_entry" : "1",
          "last_page" : 1,
          "last_page_url" : "https://www.2checkout.com/api/products/list_options?cur_page=1",
          "next_page" : null,
          "pagesize" : "20",
          "previous_page" : null,
          "total_entries" : "1"
       },
       "response_code" : "OK",
       "response_message" : "Option information retrieved successfully."
    }

Common Error Codes

Code Description
PARAMETER_MISSING Required parameter missing:
PARAMETER_INVALID Invalid value for parameter:
RECORD_NOT_FOUND Unable to find record.