Customers


Overview

The customer API allows you to create, view, update, and delete individual, or a batch, of customers.


Create a customer

This API helps you to create a new customer.

createCustomer({})

Parameters

String email,
String firstName,
String lastName,
String userName,
Map<String, dynamic> billing,
Map<String, dynamic> shipping

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.createCustomer({
      String email,
      String firstName,
      String lastName,
      String userName,
      Map<String, dynamic> billing,
      Map<String, dynamic> shipping,
      }).then( (customer) {
        print(customer);
    });

});

Response

Customer instance

Represents the following object - WooCommerce create a customer


Retrieve a customer

This API lets you retrieve and view a specific customer by ID.

retrieveCustomer({int id})

Parameters

int id

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.retrieveCustomer({int id}).then( (customer) {
        print(customer.toJson());
    });

});

Response

Customers instance

Represents the following object - WooCommerce retrieve a customer


List all customers

Returns customers back from WooCommerce, include parementers to query data.

getCustomers()

Parameters

int page,
int perPage,
String search,
List<int> exclude,
List<int> include,
int offset,
String order,
String orderBy,
bool hideEmpty,
int parent,
int product,
String email,
String slug,
String role

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.getCustomers().then( (customers) {
        print(customers);
    });

});

Response

List<Customer> instance

Represents the following object - WooCommerce list all customers


Update a customer

This API lets you make changes to a customer.

updateCustomer(int id, { data })

Parameters

Map<String, dynamic> data

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.updateCustomer(int id, {Map<String, dynamic> data}).then( (customers) {
        print(customers);
    });

});

Response

Customer instance

Represents the following object - WooCommerce update a customer


Delete a customer

This API helps you delete a customer.

deleteCustomer(int id, {bool force = false})

Parameters

bool force

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.deleteCustomer(int id, {bool force = false}).then( (customer) {
        print(customer.toJson());
    });

});

Response

List<Customer> instance

Represents the following object - WooCommerce delete a customer


Batch update customers

This API helps you to batch create, update and delete multiple customers.

batchCustomers({ data })

Parameters

Map<String, dynamic> data

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.batchCustomers({Map<String, dynamic> data}).then( (customerBatch) {
        print(customerBatch.toString());
    });

});

Response

CustomerBatch instance

Represents the following object - WooCommerce batch update customers


Retrieve customer downloads

This API lets you retrieve customer downloads permissions.

retrieveCustomerDownloads({ @required int customerid })

Parameters

String downloadId,
String downloadUrl,
int productId,
String productName,
String downloadName,
int orderId,
String orderKey,
String downloadsRemaining,
String accessExpires,
String accessExpiresGmt,
Map<String, String> file

API Call

// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};

// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {

    wcStore.retrieveCustomerDownloads(
      {@required int customerid}).then( (customers) {
        print(customers.toString());
    });

});

Response

Customers instance

Represents the following object - WooCommerce retrieve customer downloads