Customers

Mutation

allocateCustomerPayment — Returns CustomerPayment

Scopes Required: make_customer_payments

Allocate an existing customer payment to outstanding invoices

Arguments Type Description

id

ID!

The ID of the customer payment to allocate

invoices

[CustomerPaymentInput]

The invoices and amounts to allocate the customer payment to

Example Mutation
mutation AllocateCustomerPayment($id: ID!) {
    allocateCustomerPayment(id: $id) {
        id,
        reference,
        status,
        startBalance,
        amount
    }
}

# Example variables
{
    "id": "<ID>"
}

Mutation

bulkDeleteCustomers — Returns boolean

Scopes Required: delete_products

Bulk delete customers, this will not delete any sales and the customers can be recovered from the trash

Arguments Type Description

ids

[ID!]!

The list of customer IDs to delete

Example Mutation
mutation BulkDeleteCustomers($ids: [ID!]!) {
    bulkDeleteCustomers(ids: $ids)
}

# Example variables
{
    "ids": [
        "<IDS>"
    ]
}

Mutation

createCustomer — Returns Customer

Scopes Required: create_customers

Create a new customer

Arguments Type Description

clientId

String

Your ID of the customer, you can use this field to store your own reference, this is not displayed anywhere

billing

ContactInput

The billing details of the customer

delivery

ContactInput

The delivery details of the customer

firstName

String

The customer's first name

lastName

String

The customer's last name

code

String

A code that can be used to lookup the customer in the register

company

String

The company this customer works for

businessNumber

String

This customer's company's business number

birthday

Date

The customer's birthday

gender

String

The customer's gender, currently limited to six characters

emails

[Email]

The customer's email addresses

fax

String

The facsimile machine number for the customer

phone

String

The customer's main phone number

mobile

String

The customer's mobile number

allowMarketingEmails

Boolean

Whether this customer has opted to receive marketing emails

website

String

The website for the customer

twitter

String

The customer's twitter handle

facebook

String

The customer's facebook page

invoiceMessage

String

A message to appear on all invoices (this could be printed on receipts)

comments

String

Any comments about the customer (this is internal)

customerGroup

ID

The group this customer belongs to

overrideCustomerGroup

Boolean

Whether to override the settings the customer's group has set

loyaltyEnabled

Boolean

Whether loyalty is enabled for this customer (if overrideCustomerGroup is on)

loyaltyPoints

Float

The starting loyalty points for the customer, we highly recommend that you let Shopfront handle this

disablePromotions

Boolean

Whether this customer should not be able to receive promotions (if overrideCustomerGroup is on)

priceList

ID

The custom price list this customer can use (if overrideCustomerGroup is on)

requireOrderReference

Boolean

Whether the customer requires a reference number to complete a sale

accountLimit

Float

The account limit for the customer (if overrideCustomerGroup is on)

currentOwing

Float

The initial amount the customer owes, we highly recommend that you let Shopfront handle this

Example Mutation
mutation CreateCustomer($clientId: String) {
    createCustomer(clientId: $clientId) {
        id,
        name,
        parent,
        deleted,
        clientId
    }
}

# Example variables
{
    "clientId": "<CLIENT_ID>"
}

Mutation

createCustomerPayment — Returns CustomerPayment

Scopes Required: make_customer_payments

Create a customer payment

Arguments Type Description

customer

ID!

The ID of the customer that is making the payment

paymentMethod

ID!

The ID of the payment method they are using

paymentMethodSubtype

String

The "subtype" of the payment method (e.g. VISA / MASTERCARD for EFTPOS)

user

ID!

The user who has received the payment (defaults to the current user)

register

ID!

The register the payment was completed on

reference

String

The payment's reference number

amount

Float!

The amount that the customer paid

timestamp

DateTime!

The time the customer made the payment

relatesTo

ID

Another customer payment that this relates to, typically used to show when a payment is refunded

invoices

[CustomerPaymentInput]

The invoices the customer paid off

Example Mutation
mutation CreateCustomerPayment($customer: ID!, $paymentMethod: ID!, $user: ID!, $register: ID!, $amount: Float!, $timestamp: DateTime!) {
    createCustomerPayment(customer: $customer, paymentMethod: $paymentMethod, user: $user, register: $register, amount: $amount, timestamp: $timestamp) {
        id,
        reference,
        status,
        startBalance,
        amount
    }
}

# Example variables
{
    "customer": "<CUSTOMER>",
    "paymentMethod": "<PAYMENT_METHOD>",
    "user": "<USER>",
    "register": "<REGISTER>",
    "amount": "<AMOUNT>",
    "timestamp": "<TIMESTAMP>"
}

Mutation

deleteCustomer — Returns Customer

Scopes Required: delete_customers

Delete a customer, this will not delete any sales and the customer can be recovered from the trash

Arguments Type Description

id

String!

The ID of the customer to delete

Example Mutation
mutation DeleteCustomer($id: String!) {
    deleteCustomer(id: $id) {
        id,
        name,
        parent,
        deleted,
        clientId
    }
}

# Example variables
{
    "id": "<ID>"
}

Mutation

mergeCustomers — Returns Customer

Scopes Required: create_customers delete_customers

Merge customers into a new customer

Arguments Type Description

clientId

String

Your ID of the customer, you can use this field to store your own reference, this is not displayed anywhere

billing

ContactInput

The billing details of the customer

delivery

ContactInput

The delivery details of the customer

firstName

String

The customer's first name

lastName

String

The customer's last name

code

String

A code that can be used to lookup the customer in the register

company

String

The company this customer works for

businessNumber

String

This customer's company's business number

birthday

Date

The customer's birthday

gender

String

The customer's gender, currently limited to six characters

emails

[Email]

The customer's email addresses

fax

String

The facsimile machine number for the customer

phone

String

The customer's main phone number

mobile

String

The customer's mobile number

allowMarketingEmails

Boolean

Whether this customer has opted to receive marketing emails

website

String

The website for the customer

twitter

String

The customer's twitter handle

facebook

String

The customer's facebook page

invoiceMessage

String

A message to appear on all invoices (this could be printed on receipts)

comments

String

Any comments about the customer (this is internal)

customerGroup

ID

The group this customer belongs to

overrideCustomerGroup

Boolean

Whether to override the settings the customer's group has set

loyaltyEnabled

Boolean

Whether loyalty is enabled for this customer (if overrideCustomerGroup is on)

loyaltyRate

Float

The custom rate multiplier for the customer (if overrideCustomerGroup is on) - this is currently not in use

disablePromotions

Boolean

Whether this customer should not be able to receive promotions (if overrideCustomerGroup is on)

priceList

ID

The custom price list this customer can use (if overrideCustomerGroup is on)

accountLimit

Float

The account limit for the customer (if overrideCustomerGroup is on)

merge

[ID]

The list of customer IDs to merge into the new customer

Example Mutation
mutation MergeCustomers($clientId: String) {
    mergeCustomers(clientId: $clientId) {
        id,
        name,
        parent,
        deleted,
        clientId
    }
}

# Example variables
{
    "clientId": "<CLIENT_ID>"
}

Mutation

updateCustomer — Returns Customer

Scopes Required: edit_customers

Arguments Type Description

id

String!

The ID of the customer, this can either be the customer's ID or their client ID

billing

ContactInput

The billing details of the customer

delivery

ContactInput

The delivery details of the customer

firstName

String

The customer's first name

lastName

String

The customer's last name

code

String

A code that can be used to lookup the customer in the register

company

String

The company this customer works for

businessNumber

String

This customer's company's business number

birthday

Date

The customer's birthday

gender

String

The customer's gender, currently limited to six characters

emails

[Email]

The customer's email addresses

fax

String

The facsimile machine number for the customer

phone

String

The customer's main phone number

mobile

String

The customer's mobile number

allowMarketingEmails

Boolean

Whether this customer has opted to receive marketing emails

website

String

The website for the customer

twitter

String

The customer's twitter handle

facebook

String

The customer's facebook page

invoiceMessage

String

A message to appear on all invoices (this could be printed on receipts)

comments

String

Any comments about the customer (this is internal)

customerGroup

ID

The group this customer belongs to

overrideCustomerGroup

Boolean

Whether to override the settings the customer's group has set

loyaltyEnabled

Boolean

Whether loyalty is enabled for this customer (if overrideCustomerGroup is on)

loyaltyPoints

Float

The starting loyalty points for the customer, we highly recommend that you let Shopfront handle this

disablePromotions

Boolean

Whether this customer should not be able to receive promotions (if overrideCustomerGroup is on)

priceList

ID

The custom price list this customer can use (if overrideCustomerGroup is on)

requireOrderReference

Boolean

Whether the customer requires a reference number to complete a sale

accountLimit

Float

The account limit for the customer (if overrideCustomerGroup is on)

currentOwing

Float

The initial amount the customer owes, we highly recommend that you let Shopfront handle this

Example Mutation
mutation UpdateCustomer($id: String!) {
    updateCustomer(id: $id) {
        id,
        name,
        parent,
        deleted,
        clientId
    }
}

# Example variables
{
    "id": "<ID>"
}

Mutation

voidCustomerPayment — Returns CustomerPayment

Scopes Required: make_customer_payments

This will void the customer payment, marking it as cancelled and reversing the payments it applied to invoices

Arguments Type Description

id

ID!

The ID for the customer payment

Example Mutation
mutation VoidCustomerPayment($id: ID!) {
    voidCustomerPayment(id: $id) {
        id,
        reference,
        status,
        startBalance,
        amount
    }
}

# Example variables
{
    "id": "<ID>"
}