Language

2Checkout Documentation

Create

You must specify your API username and password using the Twocheckout.apiusername & Twocheckout.apipassword class variables before calling a method in this class.

Method

create

Use to create a product.

Arguments

  • hash Parameters

Returns

Returns a TwocheckoutResponse object.

Example Usage:

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());

Example Response (toJson):

{
   "assigned_product_id" : "20",
   "product_id" : "4774544749",
   "response_code" : "OK",
   "response_message" : "Product successfully created"
}