Alokai
You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x

createUser

Register new user in SAP Commerce Cloud.

This method exchanges data with the createUser endpoint exposed by the SAP OCC API Users Controller.

This method works only in an anonymous user session (i.e. when the vsf-sap-token cookie is not present in the request).

Signature

export declare function createUser(
	context: SapccIntegrationContext,
	props: UserSignUpProps
): Promise<User>;

Parameters

NameRequiredTypeDescription
contextRequiredSapccIntegrationContext
propsRequiredUserSignUpPropsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns a representation of a User.

Referenced Types

Examples

Creating a new user.

import { UserSignUpProps } from '@vsf-enterprise/sapcc-types';
import { sdk } from '~/sdk';

const props: UserSignUpProps = {
  titleCode: 'mr',
  firstName: 'John',
  lastName: 'Doe',
  password: 'Test1234!',
  uid: 'test@gmail.com'
}

const user = await sdk.commerce.createUser(props);

Creating a new user and selecting response fields.

import { UserSignUpProps } from '@vsf-enterprise/sapcc-types';
import { sdk } from '~/sdk';

const props: UserSignUpProps = {
  titleCode: 'mr',
  firstName: 'John',
  lastName: 'Doe',
  password: 'Test1234!',
  uid: 'test@gmail.com',
  fields: 'uid,firstName'
}

const user = await sdk.commerce.createUser(props);

On this page