docs
  1. SCAYLE Resource Center
  2. Developer Guides
  3. Customer
  4. Create a Customer

Create a Customer

SCAYLE allows you to create a customer.

Method Signature

let response = await adminApi.apis.Customers.createCustomer({shopKey: shopKey, countryCode: countryCode}, {requestBody: customer});
let customer = response.body;

Parameters

param nametypedescription
referenceKeyStringExternal reference set by the client to integrate a third party system
firstNameStringFirst name of the customer
lastNameStringLast name of the customer
genderStringGender of the customer mentioned as per defined ENUM as "m", "f", "d"
birthDateStringDate of birth of the customer in YYYY-MM-DD format
emailStringEmail address of the customer
phoneStringPhone number of the customer
publicKeyStringPublic reference set by the client to display to customers in account areas and transactional emails
titleStringUser-defined title. It can be set to NULL otherwise
identitiesArray<CustomerIdentityProvider>An array of identity providers used by the customer

CustomerIdentityProvider

param nametypedescription
identityProviderCodeStringThe code of an Identity Provider
externalUserIdString|nullThe user ID provided by the Identity Provider

Create a Customer

let customer = {
     "firstName": "John",
     "lastName": "Doe",
     "title": "Prof.",
     "gender": "m",
     "birthDate": "1980-01-01",
     "email": "[email protected]",
     "phone": "0049/1234567890",
     "publicKey": "pubKey-123",
     "referenceKey": "refKey-456"
};

let response = await adminApi.apis.Customers.createCustomer({shopKey: 'ms', countryCode: 'DE'}, {requestBody: customer});
customer = response.body;

console.log(customer.id);

Create with Groups

Create a customer with groups.

let customer = {
  "firstName": "John",
  "lastName": "Doe",
  "title": "Prof.",
  "gender": "m",
  "birthDate": "1980-01-01",
  "email": "[email protected]",
  "phone": "0049/1234567890",
  "publicKey": "customer-1234",
  "groups": [
    "employee"
  ]
};

let response = await adminApi.apis.Customers.createCustomer({shopKey: 'ms', countryCode: 'DE'}, {requestBody: customer});
customer = response.body;

console.log(customer.id);

Create with Identity Providers

Create a customer with one or more identity providers.

let customer = {
     "firstName": "John",
     "lastName": "Doe",
     "title": "Prof.",
     "gender": "m",
     "birthDate": "1980-01-01",
     "email": "[email protected]",
     "phone": "0049/1234567890",
     "publicKey": "pubKey-123",
     "referenceKey": "refKey-456",
     "identities": [
          {
               "identityProviderCode": "keycloak"
          },
          {
               "identityProviderCode": "apple",
               "externalUserId": "qwerty"
          }
     ]
};

let response = await adminApi.apis.Customers.createCustomer({shopKey: 'ms', countryCode: 'DE'}, {requestBody: customer});
customer = response.body;

console.log(customer.id);