Language

2Checkout Documentation

Detail Product

The detail_product call is used to retrieve the details for a single product.

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

HTTP Method: GET


Input Parameters

Parameter Description
product_id ID of product to retrieve details for. Required.

Data Returned

product

Parameter Description
product_id System Product ID.
name Product Name
vendor_product_id Merchant Assigned Product ID.
description Product Short Description.
long_description Product Long Description.
price Product Price.
tangible Tangible=1, Intangible=0.
weight Product Weight.
handling Product Handling Fee.
recurrence Product Recurrence.
startup_fee Recurring Startup Fee.
duration Product Duration.
assigned_product_id 2CO Assigned Product ID.
pending_url Product Pending URL.
approved_url Product Approved URL.
commission Affiliate commision.
commission_type Affiliate commision type.

images

Parameter Description
image_number Image number.
image_id Image ID.

options

Parameter Description
option_value_id Product option value.
option_id Product option ID.
option_name Product option name.
vendor_id Merchant ID (2Checkout Account Number) of user.
option_value_surcharge Option value surcharge.
option_value_name Option value name.

categories

Parameter Description
category_id Category ID
name Category name.
parent_id Category parent ID.
description Category description.
parent_name Category parent name.

Example API Call

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

$args = array(
    'product_id' => 4838125968
);

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

product = Twocheckout::Product.find({:product_id => 4839045783})
args = {
    product_id: 4635212971
};

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

params = {
    'product_id': 4774467881
}

product = twocheckout.Product.find(params)
var ServiceObject = new ProductService();
var ArgsObject = new ProductRetrieveServiceOptions();
ArgsObject.product_id = product_id;

var result = ServiceObject.Retrieve(ArgsObject);
Product product = TwocheckoutProduct.retrieve(product_id);
Assert.assertEquals(product_id, String.valueOf(product.getProductId()));
curl -G https://www.2checkout.com/api/products/detail_product \
    -H 'Accept: application/json' -u 'username:password' \
    -d 'product_id=4635212971'

Example Successful Response

    {
       "product" : {
          "approved_url" : null,
          "assigned_product_id" : "2559",
          "categories" : [],
          "commission" : 0,
          "commission_amount" : null,
          "commission_type" : null,
          "description" : "An API created product",
          "duration" : null,
          "handling" : null,
          "images" : [],
          "long_description" : null,
          "name" : "API product",
          "options" : [
             {
                "option_id" : "4023756741",
                "option_name" : "extra benefit",
                "option_values" : [
                   {
                      "option_value_id" : "4023756744",
                      "option_value_name" : "full life coverage",
                      "option_value_surcharge" : "1.00"
                   },
                   {
                      "option_value_id" : "4023756747",
                      "option_value_name" : "half life coverage",
                      "option_value_surcharge" : "0.50"
                   },
                   {
                      "option_value_id" : "4023756750",
                      "option_value_name" : "extra lives coverage",
                      "option_value_surcharge" : "2.00"
                   }
                ]
             },
             {
                "option_id" : "4688355343",
                "option_name" : "decibels",
                "option_values" : [
                   {
                      "option_value_id" : "4688355346",
                      "option_value_name" : "150dB",
                      "option_value_surcharge" : "11.00"
                   },
                   {
                      "option_value_id" : "4688441332",
                      "option_value_name" : "200dB",
                      "option_value_surcharge" : "22.00"
                   },
                   {
                      "option_value_id" : "4688441335",
                      "option_value_name" : "250dB",
                      "option_value_surcharge" : "33.00"
                   }
                ]
             }
          ],
          "pending_url" : null,
          "price" : "10.00",
          "product_id" : "4635212971",
          "recurrence" : null,
          "recurrence_p" : null,
          "recurring" : "0",
          "startup_fee" : null,
          "tangible" : "0",
          "vendor_id" : "606917",
          "vendor_product_id" : "",
          "weight" : null
       },
       "response_code" : "OK",
       "response_message" : "Product detail 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.
FORBIDDEN Access denied to product.