Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Module: Sales_Order_Creditmemo

Allows you to operate with credit memos for orders.

Resource: sales_order_creditmemo

Aliases: order_creditmemo

Methods:
Faults:
Fault CodeFault Message
100Requested credit memo does not exist.
101Invalid filter given. Details in error message.
102Invalid data given. Details in error message.
103Requested order does not exist.
104Credit memo status not changed.
105Money can not be refunded to the store credit account as order was created by guest.
106Credit memo for requested order can not be created.
Example:
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

// Create creditmemo
$orderIncrementId = '100000683'; //increment id of the invoiced order
$data = array(
    'qtys' => array(
        '712' => 1
    ),
    'shipping_amount' => 3,
    'adjustment_positive' => 0.7,
    'adjustment_negative' => 0.06
);
$creditmemoIncrementId = $proxy->call($sessionId, 'order_creditmemo.create', array($orderIncrementId, $data));
echo $creditmemoIncrementId . "<br />";

// Add comment to created creditmemo
$commentText = "Credit memo comment successfully added";
$isCommentAdded = $proxy->call($sessionId, 'order_creditmemo.addComment', array($creditmemoIncrementId, $commentText, true));

// Retrieve information about created creditmemo
$creditmemoInfo = $proxy->call($sessionId, 'order_creditmemo.info', array($creditmemoIncrementId));
print_r($creditmemoInfo);

// Retrieve list of creditmemos by filter
$filter = array(
    'increment_id' => array(
        'or' => array(
            array(
                'from' => '100000617',
                'to' => '100000619',
            ),
            array(
                'from' => $creditmemoIncrementId,
                'to' => NULL,
            )
        )
    )
);
$creditmemoList = $proxy->call($sessionId, 'order_creditmemo.list', array($filter));
print_r($creditmemoList);

Table of contents