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.
| Field | Type | Description |
|---|---|---|
id | string | AccruPay customer ID. |
merchantInternalCustomerCode | string | Your stable customer identifier. |
email | string | Customer email address. |
firstName | string | First name. |
lastName | string | Last name. |
phone | string | null | Phone number. |
addressLine1 | string | null | Street address line 1. |
addressLine2 | string | null | Street address line 2. |
addressCity | string | null | City. |
addressState | string | null | State or province. |
addressPostalCode | string | null | Postal / ZIP code. |
addressCountry | string | null | ISO 3166-1 alpha-2 country code. |
providerCode | string | null | Provider's customer identifier. |
providerError | string | null | Last provider error, if any. |
providerLastSyncedAt | string | null | ISO timestamp of last sync. |
providerLastVerifiedAt | string | null | ISO timestamp of last verification. |
providerStatus | string | null | Raw status from provider. |
transactionProviderId | string | Associated transaction provider. |
createdAt | string | ISO creation timestamp. |
updatedAt | string | ISO last-update timestamp. |
Related
- GraphQL API reference — full mutation and query definitions
- Payment Plans — plans reference customers via
merchantInternalCustomerCode - Payment Methods — stored methods are scoped to a customer