Language

2Checkout Documentation

List

You must specify your API username and password using the Twocheckout::API.credentials method before calling a method in this class.

Method

list

Use to retrieve a list of all products or only those matching a variety of product attributes.

Arguments

  • hash Parameters
    • Hash containing list_products parameters or just a product_id. Parameters -> API List Products

Returns

Returns a Product list.

Example Usage:

Twocheckout::API.credentials = { :username => 'APIuser1817037', :password => 'APIpass1817037' }

product_list = Twocheckout::Product.list({:pagesize => 2})

Example Response:

[
    {
        "approved_url"=>"http://www.google.com",
        "assigned_product_id"=>"2",
        "categories"=>[
            {
                "category_id"=>"33",
                "description"=>nil,
                "name"=>"Purses & Other Accessories",
                "parent_id"=>"3",
                "parent_name"=>"Apparel & Accessories"
            }
        ],
        "commission"=>nil,
        "commission_type"=>nil,
        "description"=>"Test Description",
        "duration"=>nil,
        "handling"=>"0.00",
        "images"=>[
            
        ],
        "long_description"=>nil,
        "name"=>"test",
        "options"=>[
            {
                "option_id"=>"4774386668",
                "option_name"=>"0.5",
                "option_values"=>[
                    {
                        "option_value_id"=>"4774386671",
                        "option_value_name"=>"test1",
                        "option_value_surcharge"=>"0.01"
                    },
                    {
                        "option_value_id"=>"4774386791",
                        "option_value_name"=>"test2",
                        "option_value_surcharge"=>"0.02"
                    }
                ]
            },
            {
                "option_id"=>"4774403903",
                "option_name"=>"Example Option",
                "option_values"=>[
                    {
                        "option_value_id"=>"4774403906",
                        "option_value_name"=>"Test",
                        "option_value_surcharge"=>"1.00"
                    }
                ]
            }
        ],
        "pending_url"=>nil,
        "price"=>"0.01",
        "product_id"=>"4774387610",
        "recurrence"=>nil,
        "startup_fee"=>nil,
        "tangible"=>"1",
        "vendor_id"=>"1817037",
        "vendor_product_id"=>"test",
        "weight"=>nil
    },
    {
        "approved_url"=>"http://www.google.com",
        "assigned_product_id"=>"3",
        "categories"=>[
            {
                "category_id"=>"21",
                "description"=>nil,
                "name"=>"Advice & Instruction",
                "parent_id"=>"2",
                "parent_name"=>"Business Solutions & Office Products"
            }
        ],
        "commission"=>nil,
        "commission_type"=>nil,
        "description"=>"This is a test product!",
        "duration"=>"Forever",
        "handling"=>"0.00",
        "images"=>[
            {
                "image_id"=>"4828035704",
                "image_number"=>"1"
            }
        ],
        "long_description"=>nil,
        "name"=>"Example Product",
        "options"=>[
            {
                "option_id"=>"4774386668",
                "option_name"=>"0.5",
                "option_values"=>[
                    {
                        "option_value_id"=>"4774386671",
                        "option_value_name"=>"test1",
                        "option_value_surcharge"=>"0.01"
                    },
                    {
                        "option_value_id"=>"4774386791",
                        "option_value_name"=>"test2",
                        "option_value_surcharge"=>"0.02"
                    }
                ]
            }
        ],
        "pending_url"=>nil,
        "price"=>"0.01",
        "product_id"=>"4774388564",
        "recurrence"=>"1 Week",
        "startup_fee"=>nil,
        "tangible"=>"0",
        "vendor_id"=>"1817037",
        "vendor_product_id"=>"example123",
        "weight"=>nil
    }
]