Skip to main content

Payment Methods

Stored payment methods are saved payment credentials created through a previous payment or add-payment-method session. Once stored, they can be charged directly from your backend without requiring the customer to re-enter their payment details.

All operations on this page require the accrupay-api-secret header and must be called from your backend.


Payment method fields

The following fields are available on the MerchantCustomerPaymentMethod type.

FieldTypeDescription
idID!AccruPay payment method ID
customerIdStringAccruPay customer ID that owns this payment method
initialTransactionIdStringID of the transaction that created this payment method
isDefaultBoolean!Whether this is the customer's default payment method
isEnabledBoolean!Whether this payment method is active and chargeable
expiresAtDateTimeISOExpiration date (for cards)
statusPAYMENT_METHOD_STATUS!Current status (ENABLED, DISABLED, EXPIRED)
merchantInternalCustomerCodeStringYour own reference for the owning customer
methodTypePAYMENT_METHOD!Type of payment instrument (CARD, ACH, OTHER)
providerCodeString!Provider-assigned reference for this payment method
providerCustomerCodeStringProvider-assigned customer reference associated with this method
providerErrorStringProvider error detail from the last sync attempt
providerLastSyncedAtDateTimeISOWhen the payment method was last synced with the provider
providerLastVerifiedAtDateTimeISO!When the payment method was last verified as chargeable
providerStatusPAYMENT_METHOD_STATUS!Status reported by the provider (ENABLED, DISABLED, EXPIRED)
transactionProviderIdString!Provider configuration ID associated with this method
billingFirstNameStringBilling contact first name
billingLastNameStringBilling contact last name
billingEmailStringBilling email
billingPhoneStringBilling phone
billingAddressLine1StringBilling address line 1
billingAddressLine2StringBilling address line 2
billingAddressCityStringBilling address city
billingAddressStateStringBilling address state
billingAddressCountryCOUNTRY_ISO_2Billing address country (ISO 3166-1 alpha-2)
billingAddressPostalCodeStringBilling address postal code
createdAtDateTimeISO!When the payment method was stored
updatedAtDateTimeISO!When the record was last updated
paymentMethodInfoMerchantCustomerPaymentMethodInfoPayment-method-type-specific details (see union below)

paymentMethodInfo union

The paymentMethodInfo field returns the MerchantCustomerPaymentMethodInfo union. Query with inline fragments to get type-specific fields.

fragment PaymentMethodInfoFields on MerchantCustomerPaymentMethod {
paymentMethodInfo {
... on MerchantCustomerPaymentMethodCreditCardInfo {
methodType
cardBrand
cardNumberMasked
expirationMonth
expirationYear
}
... on MerchantCustomerPaymentMethodAchInfo {
methodType
accountNumber
bankName
routingNumber
secCode
entityType
}
... on MerchantCustomerPaymentMethodGenericInfo {
methodType
}
}
}

MerchantCustomerPaymentMethodCreditCardInfo fields

FieldTypeDescription
methodTypePAYMENT_METHOD!Always CARD
cardBrandStringCard network (e.g. "Visa", "Mastercard", "Amex")
cardNumberMaskedStringMasked card number (e.g. "************4242")
expirationMonthFloatExpiration month (1–12)
expirationYearFloatFour-digit expiration year

MerchantCustomerPaymentMethodAchInfo fields

FieldTypeDescription
methodTypePAYMENT_METHOD!Always ACH
accountNumberStringBank account number (may be masked)
bankNameStringName of the bank
routingNumberStringBank routing (ABA) number
secCodeTRANSACTION_ACH_SECCODENACHA Standard Entry Class code (CCD, WEB, TEL, UNKNOWN)
entityTypeENTITY_TYPEAccount holder entity type (COMPANY, INDIVIDUAL)

MerchantCustomerPaymentMethodGenericInfo fields

FieldTypeDescription
methodTypePAYMENT_METHOD!The specific method type for this generic entry

Used for provider-specific payment methods that don't map to card or ACH.


merchantApiCustomerPaymentMethods — list payment methods

Returns a paginated list of stored payment methods for your merchant account.

Query

query ListPaymentMethods(
$take: Int
$skip: Int
$after: ConnectionCursor
$first: Int
$customerId: String
$merchantInternalCustomerCode: String
$methodType: PAYMENT_METHOD
$isDefault: Boolean
$hasProviderError: Boolean
) {
merchantApiCustomerPaymentMethods(
take: $take
skip: $skip
after: $after
first: $first
customerId: $customerId
merchantInternalCustomerCode: $merchantInternalCustomerCode
methodType: $methodType
isDefault: $isDefault
hasProviderError: $hasProviderError
) {
edges {
node {
id
customerId
merchantInternalCustomerCode
methodType
isEnabled
isDefault
status
providerCode
createdAt
paymentMethodInfo {
... on MerchantCustomerPaymentMethodCreditCardInfo {
methodType
cardBrand
cardNumberMasked
expirationMonth
expirationYear
}
... on MerchantCustomerPaymentMethodAchInfo {
methodType
accountNumber
bankName
routingNumber
}
... on MerchantCustomerPaymentMethodGenericInfo {
methodType
}
}
}
cursor
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
totalCount
}
}

curl example

curl -X POST https://api.pay.accru.co/graphql \
-H "Content-Type: application/json" \
-H "accrupay-api-secret: YOUR_SECRET" \
-d '{
"query": "query ListPaymentMethods($merchantInternalCustomerCode: String, $isDefault: Boolean) { merchantApiCustomerPaymentMethods(merchantInternalCustomerCode: $merchantInternalCustomerCode, isDefault: $isDefault) { edges { node { id methodType isEnabled isDefault paymentMethodInfo { ... on MerchantCustomerPaymentMethodCreditCardInfo { methodType cardBrand cardNumberMasked expirationMonth expirationYear } } } } totalCount } }",
"variables": { "merchantInternalCustomerCode": "customer-456", "isDefault": true }
}'

Filter parameters

ParameterTypeDescription
idStringFilter by AccruPay payment method ID
transactionProviderTRANSACTION_PROVIDERFilter by provider enum
transactionProviderIdStringFilter by provider configuration ID
providerCodeStringFilter by provider-assigned payment method code
methodTypePAYMENT_METHODFilter by payment method type (CARD, ACH, OTHER)
initialTransactionIdStringFilter by the transaction that created this payment method
customerIdStringFilter by AccruPay customer ID
merchantInternalCustomerCodeStringFilter by your own customer reference code
isDefaultBooleanFilter for default payment methods
hasProviderErrorBooleanFilter for methods with or without provider sync errors
skipIntOffset for offset pagination
takeIntPage size for offset pagination
afterConnectionCursorCursor for forward pagination
firstIntPage size for cursor pagination (forward)
beforeConnectionCursorCursor for backward pagination
lastIntPage size for cursor pagination (backward)
sorting[SortingFieldSchema!]Sort configuration
tip

Filter by isDefault: true to fetch a customer's default payment method, or use hasProviderError: true to surface methods that failed their last provider sync.


merchantApiCustomerPaymentMethod — get one payment method

Fetch a single stored payment method by its ID.

Query

query GetPaymentMethod($merchantCustomerPaymentMethodId: String!) {
merchantApiCustomerPaymentMethod(
merchantCustomerPaymentMethodId: $merchantCustomerPaymentMethodId
) {
id
customerId
merchantInternalCustomerCode
methodType
isEnabled
isDefault
status
providerCode
providerStatus
providerLastVerifiedAt
expiresAt
createdAt
updatedAt
paymentMethodInfo {
... on MerchantCustomerPaymentMethodCreditCardInfo {
methodType
cardBrand
cardNumberMasked
expirationMonth
expirationYear
}
... on MerchantCustomerPaymentMethodAchInfo {
methodType
accountNumber
bankName
routingNumber
secCode
entityType
}
... on MerchantCustomerPaymentMethodGenericInfo {
methodType
}
}
}
}

Parameters

ParameterTypeRequiredDescription
merchantCustomerPaymentMethodIdString!YesAccruPay payment method ID
note

merchantCustomerPaymentMethodId is the query argument, not a field on the MerchantCustomerPaymentMethod type — the returned object exposes the ID as id. Payment methods have only this one lookup identifier; use merchantApiCustomerPaymentMethods with a filter if you need to look up by customer code.


merchantApiCustomerPaymentMethodSyncOne — sync a payment method

Fetches the latest state of a stored payment method from the provider and updates AccruPay's record. Use this when you suspect the local state is stale.

Mutation

mutation SyncPaymentMethod(
$merchantTransactionProviderId: String!
$providerCode: String!
$customer: MerchantCustomerSelector
) {
merchantApiCustomerPaymentMethodSyncOne(
merchantTransactionProviderId: $merchantTransactionProviderId
providerCode: $providerCode
customer: $customer
) {
id
methodType
isEnabled
status
providerStatus
providerLastSyncedAt
providerError
updatedAt
paymentMethodInfo {
... on MerchantCustomerPaymentMethodCreditCardInfo {
methodType
cardBrand
cardNumberMasked
expirationMonth
expirationYear
}
... on MerchantCustomerPaymentMethodAchInfo {
methodType
accountNumber
bankName
}
... on MerchantCustomerPaymentMethodGenericInfo {
methodType
}
}
}
}

curl example

curl -X POST https://api.pay.accru.co/graphql \
-H "Content-Type: application/json" \
-H "accrupay-api-secret: YOUR_SECRET" \
-d '{
"query": "mutation SyncPaymentMethod($merchantTransactionProviderId: String!, $providerCode: String!, $customer: MerchantCustomerSelector) { merchantApiCustomerPaymentMethodSyncOne(merchantTransactionProviderId: $merchantTransactionProviderId, providerCode: $providerCode, customer: $customer) { id isEnabled status providerLastSyncedAt updatedAt } }",
"variables": {
"merchantTransactionProviderId": "provider-config-id",
"providerCode": "pm_provider_ref_123",
"customer": { "merchantInternalCustomerCode": "customer-456" }
}
}'

Parameters

ParameterTypeRequiredDescription
merchantTransactionProviderIdString!YesID of the merchant-provider configuration to sync against
providerCodeString!YesProvider-assigned reference for this payment method
customerMerchantCustomerSelectorNoCustomer selector to scope the lookup
merchantInternalCustomerCodeStringNoDeprecated — use customer selector instead.

MerchantCustomerSelector fields

FieldTypeRequiredDescription
idStringNoAccruPay customer ID
merchantInternalCustomerCodeString!YesYour own customer reference code
providerCodeStringNoCustomer code on the transaction provider
resolutionStrategyCUSTOMER_RESOLUTION_STRATEGYNoHow to resolve the customer from the provided identifiers
danger

Syncing a payment method will overwrite its local state with whatever the provider returns. If the provider marks the method as invalid or expired, isEnabled will be set to false and status will reflect the provider state after sync.


merchantApiCustomerPaymentMethodSyncAll — bulk-sync payment methods

Pull and reconcile all of a customer's payment methods from the provider in one call. Use this for bulk reconciliation rather than calling syncOne per method.

mutation SyncAllPaymentMethods(
$merchantTransactionProviderId: String!
$customer: MerchantCustomerSelector
) {
merchantApiCustomerPaymentMethodSyncAll(
merchantTransactionProviderId: $merchantTransactionProviderId
customer: $customer
) {
id
methodType
isEnabled
status
providerCode
}
}

Arguments

ArgumentTypeRequiredDescription
merchantTransactionProviderIdStringYesProvider to sync against
customerMerchantCustomerSelectorNoScope the sync to a single customer. When provided, merchantInternalCustomerCode is required within it.
merchantInternalCustomerCodeStringNoDeprecated. Use the customer selector instead.

Returns: a plain array [MerchantCustomerPaymentMethod!]! (not a pagination connection).

note

There is no Node SDK wrapper for SyncAll — call it as raw GraphQL. The SDK exposes only paymentMethods.syncOne.