Magento API

SOAP

About Magento API

Module: Sales_Order_Creditmemo

Allows you to operate with credit memos for orders.

Resource: sales_order_creditmemo

Aliases: order_creditmemo

Methods:
Faults:
Fault Code Fault Message
100 Requested credit memo does not exist.
101 Invalid filter given. Details in error message.
102 Invalid data given. Details in error message.
103 Requested order does not exist.
104 Credit memo status not changed.
105 Money can not be refunded to the store credit account as order was created by guest.
106 Credit 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);