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": [
"d9634029b5e8381d106cb1c3"
],
"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": "7586b90ff6caa68671db5daf",
"created": 1752287855624,
"updated": 1727924172424,
"lastLogin": 1735582570376,
"active": true,
"birthdate": 1730768892504,
"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": "62516abcf8c64a1909c738b5",
"ref": "d055b2089f13debf5551f346",
"added": 1729524143277,
"lastModified": 1720238900429
}
],
"accountCreated": true,
"addresses": [
{
"_id": "01b3d53f0e82f995e9cb2a9b",
"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": 1712445214321,
"hash": "example"
},
"orderCount": 42,
"orderTotal": 1.23,
"creditNotesCount": 42,
"wantsCount": 42,
"vouchersCount": 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. |