m openmage

OpenMage LTS Developer Documentation


Edit this page on GitHub

Module: Mage_Customer

The Mage_Customer module allows you to create, retrieve, update, and delete customers and customer addresses.


Allows you to create, retrieve, update, and delete data about customers.

Resource Name: customer



Fault Code Fault Message
100 Invalid customer data. Details in error message.
101 Invalid filters specified. Details in error message.
102 Customer does not exist.
103 Customer not deleted. Details in error message.


Example 1. View, create, update, and delete a customer
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');

$newCustomer = array(
    'firstname'  => 'First',
    'lastname'   => 'Last',
    'email'      => '[email protected]',
    //for my version of magento ( you SHOULD NOT
    // hash the password, as in:
    // 'password_hash' => 'password'
    'password_hash'   => md5('password'),
    // password hash can be either regular or salted md5:
    // $hash = md5($password);
    // $hash = md5($salt.$password).':'.$salt;
    // both variants are valid
    'store_id'   => 0,
    'website_id' => 0

$newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));

// Get new customer info
var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));

// Update customer
$update = array('firstname'=>'Changed Firstname');
$proxy->call($sessionId, 'customer.update', array($newCustomerId, $update));

var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));

// Delete customer
$proxy->call($sessionId, 'customer.delete', $newCustomerId);

Customer Groups

Allows you to retrieve the customer groups.

Resource Name: customer_group