Mark Shipped
The mark_shipped call is used to attempt to mark an order as shipped and will attempt to reauthorize sale if specified in call. This call will send the SHIP_STATUS_CHANGED INS message.
URL: https://www.2checkout.com/api/sales/mark_shipped
HTTP Method: POST
Input Parameters
Parameter |
Description |
sale_id |
The order number/sale ID to mark shipped. Optional when invoice_id is present. |
invoice_id |
ID of the invoice to add tracking information to. Required on sales with more than one invoice. |
tracking_number |
The tracking number issued by the shipper. Required. |
cc_customer |
Specify whether the customer should be automatically notified. Use “1” for true. Defaults to false. Optional. |
reauthorize |
Reauthorize payment if payment authorization has expired. Defaults to false. Optional. |
comment |
Any text except for “<” and “>” up to 255 chars in length. 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' => 4750124492,
'tracking_number' => 'qwerty0987654321'
);
try {
$result = Twocheckout_Sale::ship($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.ship({:tracking_number => "123"})
rescue Exception => e
puts e.message
end
var tco = new Twocheckout({
apiUser: "APIuser1817037",
apiPass: "APIpass1817037",
sandbox: false
});
args = {
sale_id: "4774380224",
tracking_number: "test"
};
tco.sales.ship(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,
'tracking_number': 'test123456'
}
try:
sale = twocheckout.Sale.find(params)
result = sale.ship(params)
except TwocheckoutError as error:
print error.message
TwoCheckoutConfig.ApiUsername = "APIuser1817037";
TwoCheckoutConfig.ApiPassword = "APIpass1817037";
// TwoCheckoutConfig.Sandbox = true; #Uncomment to use Sandbox
try
{
var ArgsObject = new SaleShipServiceOptions();
ArgsObject.sale_id = 4774467596;
var result = ServiceObject.Ship(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("4831096515");
HashMap params = new HashMap();
params.put("tracking_number", "test");
TwocheckoutResponse result = sale.ship(params);
} catch (TwocheckoutException e) {
String message = e.toString();
}
curl -X POST https://www.2checkout.com/api/sales/mark_shipped \
-H 'Accept: application/json' -u 'username:password' \
-d 'tracking_number=123' -d 'cc_customer=1' -d 'sale_id=1234567890'
Example Successful Response
{
"response_code" : "OK",
"response_message" : "Sale marked shipped."
}
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. |
Method Specific Error Codes
Code |
Description |
NOTHING_TO_DO |
Item not shippable. |
TOO_LATE |
Payment is already pending or deposited and cannot be reauthorized. |
TOO_SOON |
Please wait until the next day before trying to reauthorize again. |
FAILED |
Failed to reauthorize payment. |
INTERNAL_ERROR |
Failed to marked shipped but reauthorization succeeded. |
INTERNAL_ERROR |
Failed to marked shipped. |