Language

2Checkout Documentation

Create Product

The create_product call is used to create a new product.

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

HTTP Method: POST


Input Parameters

Parameter Description
name Product Name. Required.
price Product Price. Required.
vendor_product_id Merchant Assigned Product ID. Optional.
description Product Short Description. Optional.
long_description Product Long Description. Optional.
pending_url Product Pending URL. Optional.
approved_url Product Approved URL. Optional.
tangible Tangible = 1, Intangible = 0. Optional.
weight Decimal value of weight. Required for tangible products.
handling Specifies handling charge if applicable. Required for tangible products.
recurring 1 = recurring, 0 = non-recurring. Required for recurring products.
startup_fee Specifies start up fee if applicable. Optional.
recurrence Sets billing frequency. Ex. ‘1 Week’ to bill order once a week. (Can use # Week, # Month, or # Year)
duration Sets how long to continue billing. Ex. ‘1 Year’, to continue billing based on li_#_recurrence for 1 year. (Forever or # Week, # Month, # Year)
commission 1 = commission, 0 = no commission. Required for affiliate products.
commission_type Sets commission type for product. Possible value - amount, percentage. Required for affiliate products.
commission_amount Sets commission value for product (based on commission_type). Required for affiliate products.
option_id Accepts single or multiple option IDs to assign to product. (multiple IDs would be &option_id=xxxxxxxxx repeated for each ID to assign, where xxxxxxxxx represents each ID value to assign.) Optional.
category_id Accepts single or multiple category IDs to assign product to. (multiple IDs would be &category_id=xxxxxxxxx repeated for each ID to assign, where xxxxxxxxx represents each ID value to assign.) Optional. See Valid Category IDs section below for defenetions.

Valid Category IDs

The values below can be passed in using the category_id parameter to select single or multiple category IDs to assign to product.

Art & Antiques
ID Description
15 Prints
16 Paintings
17 Photography
18 Digital Art
19 Multimedia & Crafts
20 Antiques
1 Other
Business Solutions & Office Products
ID Description
21 Advice & Instruction
22 Printing & Personalization
23 Office Supplies
24 Graphics & Logo Design
25 Online Advertising & Internet Services
26 Hosting
27 Domain Registration
2 Other
Apparel & Accessories
ID Description
28 Women’s Apparel
29 Men’s Apparel
30 Kids Apparel
31 Shoes
32 Jewelry & Watches
33 Purses & Other Accessories
34 Baby Apparel
35 Maternity Apparel
3 Other
Home, Garden & Pets
ID Description
36 Kitchen & Dining
37 Bedding & Bath
38 Garden & Patio
39 Pet Supplies
40 Baby Blankets & Gear
4 Other
Software
ID Description
41 Graphics
42 Business & Productivity
43 Web Publishing
44 Religious
5 Other
Electronics & Computers
ID Description
45 Audio, Video, MP3, & Cameras
46 Cell Phones & Accessories
47 Computers & Hardware
6 Other
Books
ID Description
48 Fiction
49 Non-Fiction
50 E-Books
7 Other
Gifts, Flowers & Gourmet Food
ID Description
51 Flowers
52 Food & Gourmet
53 Gift Baskets
54 Baby Gifts
8 Other
Sports & Outdoors
ID Description
55 Camping & Outdoors
56 Sports & Fitness
9 Other
Toys, Games, & Video Games
ID Description
57 Kids Toys
58 Collectibles
59 Games
60 Baby Toys
76 Online Gaming
10 Other
Movies, Videos, Music, CDs, DVDs & VHS
ID Description
61 Movies
62 Music
63 Fitness
64 Television
65 Instructional
11 Other
Adult
ID Description
67 Apparel
68 Toys & Novelties
75 Online Dating
12 Other
Health & Beauty
ID Description
69 Cosmetics, Fragrance & Beauty Aids
70 Vitamins & Dietary Supplements
71 Bath & Personal Care
72 Nursing & Maternity
13 Other
Automotive
ID Description
73 Accessories & Bumper Stickers
74 Parts
14 Other
Travel Services
ID Description
78 Services
79 Software
77 Other
Education
ID Description
81 Essays & Papers
80 Other

Data Returned

Parameter Description
response_code Tells the user whether or not the operation was successful.
response_message Tells the user why the operation was or was not successful.
assigned_product_id 2CO Assigned Product ID
product_id ID assigned to the product by 2Checkout.

Example API Call

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

$args = array(
    'name' => 'Example Product',
    'price' => 1.00,
    'description' => 'This is an example description'
);

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

product = Twocheckout::Product.create({'name' => "test product", 'price' => 1.00})
args = {
    name: "test product",
    price: "0.01"
};

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

params = {
    'name': 'Example Product',
    'price': 1.00
    }

result = twocheckout.Product.create(params)
var ServiceObject = new ProductService(); var ArgsObject = new ProductCreateServiceOptions();
 ArgsObject.name = "Test Product";
 ArgsObject.price = (decimal)2.00;

var result = ServiceObject.Create(ArgsObject);
HashMap params = new HashMap();
params.put("name", "test");
params.put("price", "1.00");
params.put("vendor_product_id", "Test");
params.put("description", "Test Short Description");
params.put("long_description", "Test Long Description");
params.put("approved_url", "http://www.2checkout.com");
params.put("tangible", "1");
params.put("weight", "1.50");
params.put("handling", "1.00");
params.put("recurring", "1");
params.put("recurrence", "1 Month");
params.put("duration", "Forever");
TwocheckoutResponse result = TwocheckoutProduct.create(params);

Product product = TwocheckoutProduct.retrieve(result.getProductId());
curl -X POST https://www.2checkout.com/api/products/create_product \
    -H 'Accept: application/json' -u 'username:password' \
    -d 'name=test product' -d 'price=1.00' -d 'vendor_product_id=123456789'

Example Successful Response

    {
       "assigned_product_id" : "2560",
       "product_id" : "4688359093",
       "response_code" : "OK",
       "response_message" : "Product successfully created"
    }

 


Common Error Codes

Code Description
PARAMETER_MISSING Required parameter missing:
PARAMETER_INVALID Invalid value for parameter: