2Checkout Documentation

Update Product

The update_product call is used to update a product.



Input Parameters

Parameter Description
product_id ID of product to update. Required.
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 Specifies recurrence frequency (n Week
duration Specifies recurrence duration (n Week
commission 1 = commission, 0 = no commission. Required for affiliate products.
commission_type Sets commission type for product. Possible values: 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.

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.

Example API Call


$args = array(
    'product_id' => 4838125968,
    'name' => 'New Product Name'

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

product = Twocheckout::Product.find({:product_id => 4839045783})
product = product.update({:name => "new name"})
args = {
    name: "test product",
    price: "0.01"

tco.products.update(args, function (error, data) {
    if (error) {
    } else {
twocheckout.Api.credentials({'username':'APIuser1817037', 'password':'APIpass1817037'})

params = {
    'product_id': 4837117980

product = twocheckout.Product.find(params)

params = {
    'price': 0.01

product = product.update(product)
var ServiceObject = new ProductService();
var ArgsObject = new ProductUpdateServiceOptions();
ArgsObject.approved_url = "";
ArgsObject.description = "Test123";
ArgsObject.product_id = product_id;

var result = ServiceObject.Update(ArgsObject);
Product product = TwocheckoutProduct.retrieve(product_id);
TwocheckoutResponse result = product.update();
curl -X POST \
    -H 'Accept: application/json' -u 'username:password' \
    -d 'name=test product' -d 'price=1.00' -d 'product_id=4691409938'

Example Successful Response

       "assigned_product_id" : "2561",
       "product_id" : "4691409938",
       "response_code" : "OK",
       "response_message" : "Product successfully updated"

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.