Skip to main content

userBuyerCreate Mutation

Description

Creates a new buyer with personal information, contact details, addresses, and optional list memberships. If createEshopAccount is true, the buyer is created with an eshop account and a password token is generated. If lists are provided, the buyer is added to those customer lists. Returns the created buyer.

mutation userBuyerCreate(
$email: String!
$firstName: String!
$lastName: String!
$telephone: String
$organisation: String
$taxNumber: String
$lists: [ID]
$addresses: [AddressInput]
$createEshopAccount: Boolean
) {
userBuyerCreate(
email: $email
firstName: $firstName
lastName: $lastName
telephone: $telephone
organisation: $organisation
taxNumber: $taxNumber
lists: $lists
addresses: $addresses
createEshopAccount: $createEshopAccount
) {
_id
created
updated
lastLogin
active
birthdate
firstName
lastName
email
name
path
telephone
organisation
taxNumber
lists {
_id
ref
added
lastModified
}
accountCreated
addresses {
_id
description
firstName
lastName
addressLine1
addressLine2
streetNumber
city
state
stateCode
postCode
alpha2
country
type
}
notes
verification {
status
token
code
date
hash
}
orderCount
orderTotal
creditNotesCount
wantsCount
vouchersCount
type
}
}

Variables

{
"email": "email@example.com",
"firstName": "John",
"lastName": "Doe",
"telephone": "telephone",
"organisation": "organisation",
"taxNumber": "taxNumber",
"lists": [
"8834116484bee87e4bfd2141"
],
"addresses": [
{
"description": "A description",
"addressLine1": "addressLine1",
"addressLine2": "addressLine2",
"streetNumber": 42,
"city": "Montreal",
"state": "Quebec",
"postCode": "postCode",
"alpha2": "alpha2",
"country": "Canada",
"stateCode": "stateCode",
"type": "type",
"geoLoc": {
"type": "type",
"coordinates": [
30.7
]
}
}
],
"createEshopAccount": true
}

Response

{
"userBuyerCreate": {
"_id": "511667bcf681dfc35bf0d0c6",
"created": 1745007998198,
"updated": 1763546409736,
"lastLogin": 1741372175455,
"active": true,
"birthdate": 1751862706037,
"firstName": "example",
"lastName": "example",
"email": "email@example.com",
"name": "example",
"path": "/release/1763553751/release-artist-release-name",
"telephone": "example",
"organisation": "example",
"taxNumber": "example",
"lists": [
{
"_id": "599c05f482b7fc1edcb3b59d",
"ref": "f36207f037373b769c136292",
"added": 1709444552167,
"lastModified": 1715103857213
}
],
"accountCreated": true,
"addresses": [
{
"_id": "f2222af07a6c383e96ae3ae1",
"description": "example",
"firstName": "example",
"lastName": "example",
"addressLine1": "example",
"addressLine2": "example",
"streetNumber": 42,
"city": "example",
"state": "example",
"stateCode": "example",
"postCode": "example",
"alpha2": "example",
"country": "example",
"type": "example"
}
],
"notes": "example",
"verification": {
"status": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ",
"code": "example",
"date": 1727300385868,
"hash": "example"
},
"orderCount": 42,
"orderTotal": 1.23,
"creditNotesCount": 42,
"wantsCount": 42,
"vouchersCount": 42,
"type": "example"
}
}

Arguments

NameTypeDescription
emailString!Email address of the buyer. Must be unique within the shop.
firstNameString!First name of the buyer.
lastNameString!Last name of the buyer.
telephoneStringTelephone number of the buyer.
organisationStringOrganization or company name associated with the buyer.
taxNumberStringTax identification number for the buyer.
lists[ID]List of customer list reference IDs to add the buyer to upon creation.
addresses[AddressInput]List of addresses for the buyer.
createEshopAccountBooleanWhether to create an eshop account for the buyer, allowing them to log in to the storefront. If true, a password token is generated and an account creation confirmation email is sent.

Returns

Buyer