Skip to main content

Customers

A customer record in AccruPay links your internal customer identifier to AccruPay's customer UUID. Customer records are created lazily — AccruPay creates one the first time you reference a merchantInternalCustomerCode in a transaction or payment plan.

You can also create or resolve customer records explicitly using the operations below.


merchantApiCustomerResolve

Look up a customer by your internal customer code. Returns the existing AccruPay customer record, or null if no customer with that code exists yet.

query ResolveCustomer($selector: MerchantCustomerSelector!) {
merchantApiCustomerResolve(selector: $selector) {
id
merchantInternalCustomerCode
firstName
lastName
email
phone
createdAt
updatedAt
}
}

Arguments

ArgumentTypeRequiredDescription
selectorMerchantCustomerSelectorYesCustomer lookup input

MerchantCustomerSelector fields

FieldTypeRequiredDescription
merchantInternalCustomerCodeStringYesYour internal identifier for the customer

Example variables

{
"selector": {
"merchantInternalCustomerCode": "customer-123"
}
}

merchantApiCustomerCreate

Explicitly create a customer record. Use this when you want to register a customer before their first transaction.

mutation CreateCustomer($data: MerchantCustomerCreateSchema!) {
merchantApiCustomerCreate(data: $data) {
id
merchantInternalCustomerCode
firstName
lastName
email
phone
createdAt
updatedAt
}
}

Arguments

ArgumentTypeRequiredDescription
dataMerchantCustomerCreateSchemaYesCustomer data

MerchantCustomerCreateSchema fields

FieldTypeRequiredDescription
merchantInternalCustomerCodeStringYesYour unique customer identifier — must be stable and unique within your merchant account
firstNameStringNoCustomer first name
lastNameStringNoCustomer last name
emailStringNoCustomer email address
phoneStringNoCustomer phone number

Example

mutation {
merchantApiCustomerCreate(
data: {
merchantInternalCustomerCode: "customer-123"
firstName: "Jane"
lastName: "Smith"
email: "jane@example.com"
}
) {
id
merchantInternalCustomerCode
}
}

Customer return shape

Both operations return the same customer object.

FieldTypeDescription
idStringAccruPay customer UUID
merchantInternalCustomerCodeStringYour customer identifier
firstNameStringFirst name; null if not set
lastNameStringLast name; null if not set
emailStringEmail; null if not set
phoneStringPhone; null if not set
createdAtDateTimeRecord creation timestamp
updatedAtDateTimeLast update timestamp

Notes

  • merchantInternalCustomerCode is your source-of-truth link between AccruPay and your own database. Choose a stable identifier such as your database primary key or UUID — do not use mutable values like email addresses.
  • Payment methods and payment plans are associated with customers via merchantInternalCustomerCode. A customer record is automatically created the first time that code appears in a transaction.
  • If you call merchantApiCustomerCreate with a code that already exists, the API returns a VALIDATION_ERROR.