Skip to main content

Manage authenticated customers

Authenticated customers can access additional features during a session, such managing customer addresses. To enable it, generate a referenceId string in your backend system for authenticated customers. When creating or updating the session, add the customer input field and identify the customer with the referenceId field.

mutation {
session(
input: {
id: "4fa5697b-2c7f-44ff-973a-6238f26e473c"
customer: {
referenceId: "123abc"
}
}
)
{
id
}
}

You can set an already existing address to the customer. To do that, the address also needs a referenceId to identify it. You can also give it a custom label with the label field which takes a string:

mutation {
session(
input: {
id: "4fa5697b-2c7f-44ff-973a-6238f26e473c"
customer: {
referenceId: "123abc",
addresses: [{
referenceId: "address123xyz",
label: "Custom label for Address 123 XYZ",
}]
}
}
)
{
id
}
}

Each address has three components:

  • Recipient: The name of the addressee, the communication language, and their email address and phone number.
  • Address: The actual postal address, including country, city, and street.
  • Location: The precise location, defined by latitude and longitude coordinates. This is optional by default but you can configure your merchant to always require it from customers. Both latitude and longitude values take floats as values:
mutation {
session(
input: {
id: "4fa5697b-2c7f-44ff-973a-6238f26e473c"
customer: {
referenceId: "123abc",
addresses: [{
referenceId: "address123xyz",
label: "Custom label for Address 123 XYZ",
recipient: {
firstName: String!
lastName: String!

# Communication language for the addressee.
language: LanguageEnum!

email: String
phone: String
}
address: {
country: CountryEnum!
state: String
city: String!
postalCode: String!
addressLine1: String!
addressLine2: String
note: String
}
location: {
latitude: Float!
longitude: Float!
}
}]
}
}
)
{
id
}
}