The value of the login
property on the profile is used as the shopper’s username. Each username must be unique. On many storefronts, the username is also the shopper’s email address, in which case the value of the login
property is the same as the value of the email
property.
When you create a profile through an API call, the request must explicitly set the email
property, but can omit the login
property. If the request does not specify a value for the login
property, it is set to the same value as the email
property. For example, the following request creates a profile with bobW@example.com
as both the username and the email address:
POST /ccadmin/v1/profiles HTTP/1.1
Content-Type: application/json
Authorization: Bearer <access_token>
{
"receiveEmail": "yes",
"lastName": "Wilson",
"email": "bobW@example.com",
"firstName": "Bob"
}
If you want the username to be different from the email address, you can set separate values for the email
and login
properties in the request. For example, the following request creates a profile with fwilson
as the username and fredW@example.com
as the email address:
POST /ccadmin/v1/profiles HTTP/1.1
Content-Type: application/json
Authorization: Bearer <access_token>
{
"login": "fwilson",
"receiveEmail": "yes",
"lastName": "Wilson",
"email": "fredW@example.com",
"firstName": "Fred"
}
Allow profiles to share an email address
One reason you may want the login
and email
values to differ is to allow multiple profiles to share an email address. By default, Commerce Cloud requires each profile to have a unique email address, but your business needs may make this restriction undesirable. If so, you can use the following call to allow multiple profiles to share the same email address:
PUT /ccadmin/v1/merchant/shopperProfileConfiguration HTTP/1.1
Content-Type: application/json
Authorization: Bearer <access_token>
{
"duplicateEmailsAllowed": true
}
Note that once your Commerce Cloud instance has profiles that share an email address, you cannot set duplicateEmailsAllowed
back to false
. If you try to do this, the call will return an error.