layout: m1x_soap title: Enterprise Customer Balance
Allows you to operate with customer virtual balance.
Aliases: storecredit
Fault Code | Fault Message |
---|---|
100 | Provided data is invalid. |
101 | No balance found with requested parameters. |
102 | No history found with requested parameters. |
Aliases: storecredit_quote
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. |
$proxy = new SoapClient('https://inovarti.com.br/index.php/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;