Got questions? Leave your message here or Schedule a quick call with our manager now

How to work with customers?

Customer API methods allow you to manage customers in the store. It is possible to:

  • Create - add customers
  • Read - retrieve list, info, find
  • Update - update
  • Delete - delete

Run customer.add method, to add customers to the store, and provide all necessary parameters.

public function apiAdd($params)
{
  $params = array(
    'email'      => '[email protected]',
    'first_name' => 'John',
    'last_name'  => 'Smith',
  );

  return $api->request('customer.add', $params);
}

If you want to update the customer, call customer.list method  to retrieve customer id.

public function apiList($params)
{
  $params = array(
    'start' => 0,
    'count' => 5
  );

  return $api->request('customer.list', $params);
}

When you get your customer id, you are able to perform customer.update method.

public function apiUpdate($params)
{
  $params = array(
    'id'         => 11,
    'first_name' => 'Jack',
    'last_name'  => 'Smith',
  );    

  return $api->request('customer.update', $params);
}

For more methods jump into documentation.

Posted in: Getting Started