Skip to main content

Transactions

Transactions are the core payment record in AccruPay. Every charge, refund, void, authorization, and payout is represented as a transaction.

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


Transaction fields

The following fields are available on the MerchantTransaction type. Request only the fields you need.

FieldTypeDescription
idID!AccruPay transaction ID
merchantInternalTransactionCodeStringYour own reference code for this transaction
providerCodeString!Provider-assigned transaction reference
transactionProviderIdString!ID of the merchant-provider configuration used
actionTRANSACTION_ACTION!Type of transaction (PAYMENT, REFUND, VOID, AUTHORIZATION, SETTLE, etc.)
statusTRANSACTION_STATUS!Current status
providerStatusTRANSACTION_STATUS!Provider-derived status
amountBigInt!Transaction amount in minor currency units
refundedAmountBigIntTotal amount refunded so far
currencyCURRENCY!ISO 4217 currency code
paymentMethodTypePAYMENT_METHODPayment method type (CARD, ACH, OTHER)
paymentMethodIdStringID of the stored payment method used, if any
customerIdStringAccruPay customer ID
merchantInternalCustomerCodeStringYour own reference code for the customer
providerAuthorizationCodeStringAuthorization code from the provider (cards)
providerErrorStringProvider error detail when the transaction fails
transactionErrorStringAccruPay-level error detail, if any
billingFirstNameStringBilling first name
billingLastNameStringBilling last name
billingEmailStringBilling email address
billingPhoneStringBilling phone number
billingAddressLine1StringBilling street address line 1
billingAddressLine2StringBilling street address line 2
billingAddressCityStringBilling city
billingAddressStateStringBilling state or region
billingAddressPostalCodeStringBilling postal code
billingAddressCountryCOUNTRY_ISO_2Billing country
transactionDateDateTimeISO!Effective date of the transaction
createdAtDateTimeISO!When the transaction was created
updatedAtDateTimeISO!When the transaction was last updated

The table above covers the commonly-used fields. The full MerchantTransaction type also exposes the following.

Lifecycle timestamps (all DateTimeISO, nullable unless noted):

FieldDescription
startedAtWhen processing began
succeededAtWhen the transaction succeeded
failedAtWhen it failed (declines are reflected in status + failedAt)
canceledAtWhen canceled
voidedAtWhen an authorization was voided
refundedAtWhen the first refund was issued
disputedAtWhen a dispute/chargeback opened
providerLastSyncedAtLast provider sync
providerLastVerifiedAtLast provider verification (DateTimeISO!, non-null)
tokenExpiresAtDeprecated — use the Payment Session API

Relational fields:

FieldTypeDescription
paymentMethodMerchantCustomerPaymentMethodThe stored method used
paymentMethodCodeStringProvider payment-method code
paymentPlan / paymentPlanIdMerchantPaymentPlan / StringAssociated plan, if any
relatedTransaction / relatedTransactionIdMerchantTransaction / StringParent/related transaction (e.g. the auth a settle belongs to)
transactionsRelated[MerchantTransaction!]All related transactions
clientTransactionSession / clientTransactionSessionIdMerchantClientTransactionSession / StringOriginating session
transactionProviderMerchantTransactionProvider!The provider connection that processed it

Provider & misc:

FieldTypeDescription
providerCustomerCodeStringProvider's customer code
providerRelatedCodeStringProvider's related-transaction code
storePaymentMethodBooleanWhether the method was stored on this transaction
payloadJSON!Raw provider payload
codeString!Deprecated — use the other identifiers
tokenStringDeprecated — use the Payment Session API

shipping*, user*, and device* blocks — the transaction echoes back the optional shipping, user, and device data submitted on the originating request. Field names mirror the input objects documented in Optional input objects (e.g. shippingFirstName, userEmail, deviceType).

For status semantics and transitions, see the TRANSACTION_STATUS state machine.


merchantApiTransactions — list transactions

Returns a paginated list of transactions for your merchant account.

Query

query ListTransactions(
$take: Int
$skip: Int
$after: String
$first: Int
$status: TRANSACTION_STATUS
$action: TRANSACTION_ACTION
$currency: CURRENCY
$merchantInternalTransactionCode: String
$merchantInternalCustomerCode: String
$customerId: String
$paymentMethodId: String
$transactionProviderId: String
$transactionDateFrom: DateTimeISO
$transactionDateTo: DateTimeISO
) {
merchantApiTransactions(
take: $take
skip: $skip
after: $after
first: $first
status: $status
action: $action
currency: $currency
merchantInternalTransactionCode: $merchantInternalTransactionCode
merchantInternalCustomerCode: $merchantInternalCustomerCode
customerId: $customerId
paymentMethodId: $paymentMethodId
transactionProviderId: $transactionProviderId
transactionDateFrom: $transactionDateFrom
transactionDateTo: $transactionDateTo
) {
edges {
node {
id
merchantInternalTransactionCode
providerCode
action
status
amount
currency
paymentMethodType
createdAt
updatedAt
}
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 ListTransactions($take: Int, $skip: Int, $status: TRANSACTION_STATUS) { merchantApiTransactions(take: $take, skip: $skip, status: $status) { edges { node { id merchantInternalTransactionCode status amount currency createdAt } } totalCount } }",
"variables": { "take": 10, "skip": 0, "status": "SUCCEEDED" }
}'

Filter parameters

ParameterTypeDescription
takeIntPage size for offset pagination
skipIntOffset for offset pagination
firstIntPage size for cursor pagination (forward)
lastIntPage size for cursor pagination (backward)
afterStringCursor for forward pagination
beforeStringCursor for backward pagination
statusTRANSACTION_STATUSFilter by transaction status
actionTRANSACTION_ACTIONFilter by transaction action type
currencyCURRENCYFilter by currency
merchantInternalTransactionCodeStringFilter by your transaction reference
merchantInternalCustomerCodeStringFilter by your customer reference
customerIdStringFilter by AccruPay customer ID
paymentMethodIdStringFilter by stored payment method ID
transactionProviderIdStringFilter by merchant-provider configuration ID
transactionDateFromDateTimeISOFilter transactions dated on or after this timestamp
transactionDateToDateTimeISOFilter transactions dated on or before this timestamp

merchantApiTransaction — get one transaction

Fetch a single transaction by any of three identifiers. Provide exactly one.

Query

query GetTransaction(
$id: String
$merchantInternalTransactionCode: String
$providerCode: String
) {
merchantApiTransaction(
id: $id
merchantInternalTransactionCode: $merchantInternalTransactionCode
providerCode: $providerCode
) {
id
merchantInternalTransactionCode
providerCode
action
status
amount
currency
paymentMethodType
providerError
transactionError
billingFirstName
billingLastName
billingEmail
createdAt
updatedAt
}
}

Identifiers

ParameterTypeDescription
idStringAccruPay transaction ID
merchantInternalTransactionCodeStringYour own transaction reference code
providerCodeStringProvider-assigned transaction reference
tip

Use merchantInternalTransactionCode when you need to look up a transaction using your own internal order or invoice ID.


merchantApiTransactionVoid — void a transaction

Voids an authorized or pending transaction before it is captured. Returns the updated transaction.

Mutation

mutation VoidTransaction(
$id: String
$merchantInternalTransactionCode: String
$providerCode: String
) {
merchantApiTransactionVoid(
id: $id
merchantInternalTransactionCode: $merchantInternalTransactionCode
providerCode: $providerCode
) {
id
status
action
amount
currency
updatedAt
}
}

Identifiers

ParameterTypeDescription
idStringAccruPay transaction ID
merchantInternalTransactionCodeStringYour own transaction reference code
providerCodeStringProvider-assigned transaction reference

Provide exactly one identifier.


merchantApiTransactionRefund — refund a transaction

Refunds a previously completed transaction. You must always provide the amount to refund.

Mutation

mutation RefundTransaction(
$amount: BigInt!
$id: String
$merchantInternalTransactionCode: String
$providerCode: String
) {
merchantApiTransactionRefund(
amount: $amount
id: $id
merchantInternalTransactionCode: $merchantInternalTransactionCode
providerCode: $providerCode
) {
id
status
action
amount
currency
updatedAt
}
}

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 RefundTransaction($amount: BigInt!, $id: String) { merchantApiTransactionRefund(amount: $amount, id: $id) { id status action amount currency updatedAt } }",
"variables": { "amount": 5000, "id": "txn_abc123" }
}'

Parameters

ParameterTypeRequiredDescription
amountBigInt!YesAmount to refund in minor currency units
idStringOne requiredAccruPay transaction ID
merchantInternalTransactionCodeStringOne requiredYour own transaction reference code
providerCodeStringOne requiredProvider-assigned transaction reference
warning

amount is always required. There is no full-refund shorthand — you must explicitly pass the full transaction amount if you intend to refund completely. Partial refunds use the same mutation with a smaller amount.


merchantApiTransactionSyncOne — sync transaction state

Fetches the latest state of a transaction from the provider and updates AccruPay's record. Use this when you suspect the local status is stale or after a webhook is delayed.

Mutation

mutation SyncTransaction(
$merchantTransactionProviderId: String!
$id: String
$merchantInternalTransactionCode: String
$providerCode: String
) {
merchantApiTransactionSyncOne(
merchantTransactionProviderId: $merchantTransactionProviderId
id: $id
merchantInternalTransactionCode: $merchantInternalTransactionCode
providerCode: $providerCode
) {
id
status
action
amount
currency
updatedAt
}
}

Parameters

ParameterTypeRequiredDescription
merchantTransactionProviderIdString!YesID of the merchant-provider configuration to sync against
idStringOne requiredAccruPay transaction ID
merchantInternalTransactionCodeStringOne requiredYour own transaction reference code
providerCodeStringOne requiredProvider-assigned transaction reference
note

merchantTransactionProviderId is always required for sync, in addition to one transaction identifier. This tells AccruPay which provider connection to query for the latest state.