Language

2Checkout Documentation

Create Comment

The create_comment call is used to add a comment to a specified sale.

URL: https://www.2checkout.com/api/sales/create_comment

HTTP Method: POST


Input Parameters

Parameter Description
sale_id The order number/sale ID of a sale to look for. Required.
sale_comment String value of comment to be submitted. Required.
cc_vendor Set to 1 to have a copy sent to the merchant. Optional.
cc_customer Set to 1 to have the buyer sent an email copy. 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

Twocheckout::username('testlibraryapi901248204');
Twocheckout::password('testlibraryapi901248204PASS');
// Twocheckout::sandbox(true);  #Uncomment to use Sandbox

$args = array(
    'sale_id' => 4837725728,
    'sale_comment' => 'Your order will be shipped soon.',
    'cc_customer' => 1
);

try {
    $result = Twocheckout_Sale::comment($args);
} catch (Twocheckout_Error $e) {
    $e->getMessage();
}
Twocheckout::API.credentials = {
  :username => 'APIuser1817037',
  :password => 'APIpass1817037',
# :sandbox => 1   #Uncomment to use Sandbox
}

begin
  sale = Twocheckout::Sale.find(:sale_id => 4786293822)
  result = sale.comment({:sale_comment => "test"})
rescue Exception => e
  puts e.message
end
var tco = new Twocheckout({
    apiUser: "APIuser1817037",
    apiPass: "APIpass1817037",
    sandbox: false 
});

args = {
    sale_id: "4774380224",
    sale_comment: "nodejs test"
};


tco.sales.comment(args, function (error, data) {
    if (error) {
        console.log(error);
    } else {
        console.log(data.response_code);
    }
});
twocheckout.Api.auth_credentials({
    'username': APIuser1817037',
    'password': 'APIpass1817037',
#   'mode': 'sandbox'  #Uncomment to use Sandbox
})

params = {
    'sale_id': 4774467596,
    'sale_comment': 'test'
}

try:
    sale = twocheckout.Sale.find(params)
    result = sale.comment(params)
except TwocheckoutError as error:
    print error.message
TwoCheckoutConfig.ApiUsername = "APIuser1817037";
TwoCheckoutConfig.ApiPassword = "APIpass1817037";
// TwoCheckoutConfig.Sandbox = true;    #Uncomment to use Sandbox

try
{
    var ServiceObject = new SaleService();
    var ArgsObject = new SaleCommentServiceOptions();
    ArgsObject.sale_id = sale_id;
    ArgsObject.sale_comment = "Test";

    var result = ServiceObject.Comment(ArgsObject);
    Console.Write(result);
}
catch (TwoCheckoutException e)
{
    Console.Write(e);
}
TwoCheckoutConfig.ApiUsername = "APIuser1817037";
TwoCheckoutConfig.ApiPassword = "APIpass1817037";
// Twocheckout.mode = "sandbox";    #Uncomment to use Sandbox

try {
    Sale sale = TwocheckoutSale.retrieve("4832772521");
    HashMap params = new HashMap();
    params.put("sale_comment", "test");

    TwocheckoutResponse result = sale.comment(params);
} catch (TwocheckoutException e) {
    String message = e.toString();
}
curl -X POST https://www.2checkout.com/api/sales/create_comment -u \
    'username:password' -H 'Accept: application/json' -d 'sale_id=1234567890' \
    -d 'sale_comment=Your order will be shipped this week.'

Example Successful Response

    {
       "response_code" : "OK",
       "response_message" : "Created comment 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 sale.