Skip to main content

Customers

SDK stub — use GraphQL directly

The @accrupay/node customers service currently exports GraphQL fragments only. There are no query functions available on accrupay.customers.*. Use the GraphQL API directly with a raw GraphQL client until full SDK support is added.

Concepts

Resolve a customer

Resolves (or creates) a customer record by your internal code. AccruPay uses merchantInternalCustomerCode as the stable link between your system and the provider.

Selector type

type MerchantCustomerSelector = {
merchantInternalCustomerCode: string;
};

Equivalent GraphQL operation (send directly via your HTTP client):

mutation MerchantResolveCustomer($input: MerchantCustomerResolveInput!) {
merchantResolveCustomer(input: $input) {
id
merchantInternalCustomerCode
providerCode
email
firstName
lastName
}
}
// Variables
{
input: {
transactionProviderId: 'provider-id',
customer: {
merchantInternalCustomerCode: 'customer-123',
email: 'user@example.com',
firstName: 'Jane',
lastName: 'Doe',
},
},
}

Create a customer with a provider

Creates the customer record in AccruPay and registers it with the connected payment provider.

mutation MerchantCreateCustomer($input: MerchantCustomerCreateInput!) {
merchantCreateCustomer(input: $input) {
id
merchantInternalCustomerCode
providerCode
providerStatus
}
}
// Variables
{
input: {
transactionProviderId: 'provider-id',
customer: {
merchantInternalCustomerCode: 'customer-123',
email: 'user@example.com',
firstName: 'Jane',
lastName: 'Doe',
phone: '+15550001234',
addressLine1: '123 Main St',
addressCity: 'Austin',
addressState: 'TX',
addressPostalCode: '78701',
addressCountry: 'US',
},
},
}

Customer fields

Returned by GraphQL operations as MerchantCustomerBaseFragment.

FieldTypeDescription
idstringAccruPay customer ID.
merchantInternalCustomerCodestringYour stable customer identifier.
emailstringCustomer email address.
firstNamestringFirst name.
lastNamestringLast name.
phonestring | nullPhone number.
addressLine1string | nullStreet address line 1.
addressLine2string | nullStreet address line 2.
addressCitystring | nullCity.
addressStatestring | nullState or province.
addressPostalCodestring | nullPostal / ZIP code.
addressCountrystring | nullISO 3166-1 alpha-2 country code.
providerCodestring | nullProvider's customer identifier.
providerErrorstring | nullLast provider error, if any.
providerLastSyncedAtstring | nullISO timestamp of last sync.
providerLastVerifiedAtstring | nullISO timestamp of last verification.
providerStatusstring | nullRaw status from provider.
transactionProviderIdstringAssociated transaction provider.
createdAtstringISO creation timestamp.
updatedAtstringISO last-update timestamp.