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
checkoutCount
type
}
}
Variables
{
"email": "email@example.com",
"firstName": "John",
"lastName": "Doe",
"telephone": "telephone",
"organisation": "organisation",
"taxNumber": "taxNumber",
"lists": [
"5aab30aa820ea587f9a29939"
],
"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": "8cfe3744920e7428516becd8",
"created": 1749981743428,
"updated": 1763624969771,
"lastLogin": 1771128497116,
"active": true,
"birthdate": 1733717329724,
"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": "7ccc6e3f8b3814febc356f4b",
"ref": "054fb906321d7c86ad14d06a",
"added": 1735748639142,
"lastModified": 1713576769769
}
],
"accountCreated": true,
"addresses": [
{
"_id": "b84dd1cf2db1baf83a9e1af4",
"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": 1755378754970,
"hash": "example"
},
"orderCount": 42,
"orderTotal": 1.23,
"creditNotesCount": 42,
"wantsCount": 42,
"vouchersCount": 42,
"checkoutCount": 42,
"type": "example"
}
}
Arguments
| Name | Type | Description |
|---|---|---|
email | String! | Email address of the buyer. Must be unique within the shop. |
firstName | String! | First name of the buyer. |
lastName | String! | Last name of the buyer. |
telephone | String | Telephone number of the buyer. |
organisation | String | Organization or company name associated with the buyer. |
taxNumber | String | Tax 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. |
createEshopAccount | Boolean | Whether 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. |