Magento API

SOAP

About Magento API

Store Credit API

Allows you to operate with customer virtual balance.

Module: Enterprise_CustomerBalance

Resource: enterprise_customerbalance

Aliases: storecredit

Methods:
Faults:
Fault Code Fault Message
100 Provided data is invalid.
101 No balance found with requested parameters.
102 No history found with requested parameters.

Resource: enterprise_customerbalance_quote

Aliases: storecredit_quote

Methods:
Faults:
Fault Code Fault Message
100 Provided data is invalid.
103 No quote found with requested id.
104 Store credit can not be used for quote created by guest.
105 No store found with requested id or code.
Example:
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

$customerId = 10002;
$websiteId = 1;
// Get customer balance amount
$balanceAmount = $proxy->call($sessionId, 'storecredit.balance', array($customerId, $websiteId));
echo $balanceAmount . "<br />";
// Get store credit history for specified customer
$balanceHistory = $proxy->call($sessionId, 'storecredit.history', array($customerId));
print_r($balanceHistory);

$quoteId = 2;
$store = 'default';
// Set customer balance use in shopping cart (quote)
$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.setAmount', array($quoteId, $store));
echo $balanceAmountUsedInQuote . "<br />";
// Unset customer balance use in shopping cart (quote)
$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.removeAmount', array($quoteId));
echo $balanceAmountUsedInQuote;