header

Magento 1.x Software Support Notice

For Magento Commerce 1, Magento is providing software support through June 2020. Depending on your Magento Commerce 1 version, software support may include both quality fixes and security patches. Please review our Magento Software Lifecycle Policy to see how your version of Magento Commerce 1 is supported.

For Magento Open Source 1.5 to 1.9, Magento is providing software security patches through June 2020 to ensure those sites remain secure and compliant. Visit our information page for more details about our software maintenance policy and other considerations for your business.

Shipment Create

Edit this page on GitHub

Module: Mage_Sales

Resource: sales_order_shipment

Aliases:

Method:

Allows you to create a new shipment for an order.

Aliases:

Arguments:

Type Name Description
string sessionId Session ID
string orderIncrementId
Order increment ID
array itemsQty
Array of orderItemIdQty (optional)
string comment
Shipment comment (optional)
int email
Send email flag (optional)
int includeComment
Include comment in email flag (optional)

Returns:

Type Name Description
string shipmentIncrementId
Shipment increment ID

The orderItemIdQty content is as follows:

Type Name Description
int order_item_id
Order item ID
double qty
Quantity of items to be shipped

Notes: The array of orderItemQty is used for partial shipment. To create shipment for all order items, you do not need to specify these attributes.

Examples

Request Example SOAP V1
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');

$session = $proxy->login('apiUser', 'apiKey');

$orderIncrementId = '200000006';
$orderItemId = 3;
$qty = 5;
$itemsQty = array(
	$orderItemId => $qty,
    );

$result = $proxy->call(
    $session,
    'order_shipment.create',
    array(
        $orderIncrementId,
        $itemsQty
    )
);

var_dump ($result);
Request Example SOAP V2
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

$itemsQty = array(
    array(
        'order_item_id' => 3,
        'qty' => 3
    ),
    array(
        'order_item_id' => 4,
        'qty' => 5
    ));

$result = $proxy->salesOrderShipmentCreate($sessionId, '200000006', $itemsQty, 'shipment comment');
var_dump($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey')); 

$itemsQty = array(
    array(
        'order_item_id' => 3,
        'qty' => 3
    ),
    array(
        'order_item_id' => 4,
        'qty' => 5
    ));
 
$result = $proxy->salesOrderShipmentCreate((object)array(
    'sessionId' => $sessionId->result,
    'orderIncrementId' => '200000006',
    'itemsQty' => $itemsQty,
    'comment' => 'shipment comment',
    'email' => null, 'includeComment' => null));   
    
var_dump($result->result);