Skip to main content

Transaction Operations

Use these methods to query, refund, void, sync, and capture transactions after they have been created. These are backend operations — all calls require your API secret.


transactions.getMany()

Returns a paginated list of transactions matching the provided filters.

Filter parameters

ParameterTypeDescription
idstringFilter by transaction ID.
paymentMethodIdstringFilter by stored payment method ID.
paymentMethodCodestringFilter by payment method provider code.
paymentMethodTypePAYMENT_METHODFilter by payment method type (card, ACH, etc.).
paymentPlanIdstringFilter by payment plan ID.
transactionProviderIdstringFilter by provider configuration ID.
clientTransactionSessionIdstringFilter by client session that created the transaction.
actionTRANSACTION_ACTIONFilter by a single transaction action.
actionsTRANSACTION_ACTION[]Filter by multiple transaction actions (OR).
statusTRANSACTION_STATUSFilter by a single status.
statusesTRANSACTION_STATUS[]Filter by multiple statuses (OR).
currencyCURRENCYFilter by currency.
transactionProviderTRANSACTION_PROVIDERFilter by provider enum.
providerCodestringFilter by provider-assigned transaction code.
providerRelatedCodestringFilter by provider-assigned related code.
hasProviderErrorbooleanFilter for transactions with or without provider errors.
merchantInternalCustomerCodestringFilter by your customer identifier.
merchantInternalTransactionCodestringFilter by your transaction idempotency key.
customerIdstringFilter by AccruPay customer ID.
relatedTransactionIdstringFilter by parent/related transaction (e.g. original charge for a refund).
failedbooleanInclude only failed transactions.
startedbooleanInclude only started (in-progress) transactions.
disputedbooleanInclude only disputed transactions.
revertedbooleanInclude only reverted transactions.
canceledbooleanInclude only canceled transactions.
succeededbooleanInclude only successful transactions.
transactionDateFromDateTimeISOFilter transactions on or after this date.
transactionDateToDateTimeISOFilter transactions on or before this date.
sortingobjectSort configuration object.

Pagination

getMany() supports two mutually exclusive pagination styles. Do not mix them in a single call.

Offset pagination

Simpler and suitable when you don't need stable cursors (e.g. admin dashboards, exports).

ParameterTypeDescription
skipnumberNumber of records to skip.
takenumberNumber of records to return.
const page2 = await sdk.transactions.getMany({
succeeded: true,
currency: CURRENCY.USD,
skip: 20,
take: 10,
});

Cursor pagination

Use when building infinite scroll, feeds, or any UI where the list can change between requests. Cursors are stable — inserting a new record won't shift your page boundaries.

ParameterTypeDescription
afterstringReturn records after this cursor (forward pagination).
firstnumberNumber of records to return after the cursor.
beforestringReturn records before this cursor (backward pagination).
lastnumberNumber of records to return before the cursor.
// Forward — first page
const result = await sdk.transactions.getMany({ first: 20 });
const cursor = result.pageInfo.endCursor;

// Forward — next page
const nextPage = await sdk.transactions.getMany({ first: 20, after: cursor });

Code example

import AccruPay, { CURRENCY, TRANSACTION_STATUS } from '@accrupay/node';

const sdk = new AccruPay({ apiSecret: process.env.ACCRUPAY_API_SECRET! });

const { data, pageInfo } = await sdk.transactions.getMany({
succeeded: true,
currency: CURRENCY.USD,
transactionDateFrom: '2024-01-01T00:00:00Z',
transactionDateTo: '2024-12-31T23:59:59Z',
first: 50,
});

transactions.getOne()

Returns a single transaction by one of three identifiers. Provide exactly one.

ParameterTypeDescription
idstringAccruPay transaction ID.
merchantInternalTransactionCodestringYour idempotency key.
providerCodestringProvider-assigned transaction identifier.
const transaction = await sdk.transactions.getOne({
merchantInternalTransactionCode: 'order-9876-charge',
});

Returns: MerchantTransaction


transactions.voidOne()

Voids a transaction, canceling it before settlement. Not all providers support post-authorization voids outside of the authorization flow — use transactions.authorizations.void() for authorized-but-uncaptured transactions.

ParameterTypeDescription
idstringAccruPay transaction ID.
merchantInternalTransactionCodestringYour idempotency key.
providerCodestringProvider-assigned transaction identifier.
const voided = await sdk.transactions.voidOne({
id: 'txn_abc123',
});

Returns: MerchantTransaction


transactions.refundOne()

Refunds a settled transaction. amount is always required — there is no shorthand for refunding the full amount.

warning

amount is required on every refund call. There is no "refund full" shorthand. To refund the full amount, pass transaction.amount.

Parameters

ParameterTypeRequiredDescription
amountbigintYesAmount to refund in smallest currency unit.
idstringNoAccruPay transaction ID.
merchantInternalTransactionCodestringNoYour idempotency key.
providerCodestringNoProvider-assigned transaction identifier.

Provide exactly one identifier alongside amount.

Partial refunds

  • Pass an amount less than transaction.amount to issue a partial refund.
  • Multiple partial refunds are allowed. Cumulative refunds cannot exceed the original transaction.amount.
  • transaction.refundedAmount tracks how much has been refunded so far.
// Full refund
const fullRefund = await sdk.transactions.refundOne({
id: 'txn_abc123',
amount: transaction.amount, // e.g. 4999n
});

// Partial refund
const partialRefund = await sdk.transactions.refundOne({
id: 'txn_abc123',
amount: 1000n, // $10.00 back
});

Returns: MerchantTransaction


transactions.syncOne()

Pulls the latest state from the provider and updates the transaction record. Use this for ACH transactions (which settle asynchronously) or to reconcile any transaction whose status is uncertain.

Parameters

ParameterTypeRequiredDescription
merchantTransactionProviderIdstringYesProvider configuration ID (required for routing the sync request).
idstringNoAccruPay transaction ID.
merchantInternalTransactionCodestringNoYour idempotency key.
providerCodestringNoProvider-assigned transaction identifier.
const synced = await sdk.transactions.syncOne({
merchantTransactionProviderId: process.env.ACCRUPAY_PROVIDER_ID!,
merchantInternalTransactionCode: 'ach-order-1234',
});

console.log(synced.status); // SUCCEEDED or FAILED after settlement

Returns: MerchantTransaction


transactions.authorizations.settle()

Captures funds from a previously authorized transaction. Call this after serverSessions.authorizations.paymentMethod.start() to finalize the charge.

note

Partial capture is supported — pass an amount less than the authorized amount. The remainder of the hold is released.

Parameters

ParameterTypeRequiredDescription
amountbigintYesAmount to capture. Must be ≤ the authorized amount.
idstringNoAccruPay transaction ID.
merchantInternalTransactionCodestringNoYour idempotency key from the authorization.
providerCodestringNoProvider-assigned authorization code.
// Full capture
const captured = await sdk.transactions.authorizations.settle({
merchantInternalTransactionCode: 'order-5555-auth',
amount: 10000n, // capture the full $100.00
});

// Partial capture — releases the uncaptured remainder
const partial = await sdk.transactions.authorizations.settle({
merchantInternalTransactionCode: 'order-5555-auth',
amount: 7500n, // capture $75.00, release remaining $25.00 hold
});

Returns: MerchantTransaction


transactions.authorizations.void()

Releases an authorized hold without capturing any funds.

ParameterTypeDescription
idstringAccruPay transaction ID.
merchantInternalTransactionCodestringYour idempotency key from the authorization.
providerCodestringProvider-assigned authorization code.
const voided = await sdk.transactions.authorizations.void({
merchantInternalTransactionCode: 'order-5555-auth',
});

Returns: MerchantTransaction


Transaction return shape

All transaction methods return a MerchantTransaction object with the following key fields.

FieldTypeDescription
idstringAccruPay transaction ID.
actionTRANSACTION_ACTIONType of transaction (e.g. PAYMENT, REFUND, AUTHORIZATION, CAPTURE, VOID).
statusTRANSACTION_STATUSCurrent status (PENDING, SUCCEEDED, FAILED, CANCELED, DECLINED, EXPIRED, etc.).
providerStatusstringRaw status string from the payment provider.
providerCodestringProvider-assigned primary transaction identifier.
providerRelatedCodestringProvider-assigned related transaction identifier (e.g. parent auth code).
providerAuthorizationCodestringAuthorization code from the provider (for card transactions).
providerErrorobject | nullProvider error detail when the transaction fails.
amountbigintTransaction amount in smallest currency unit.
refundedAmountbigintTotal refunded so far (sum of all partial/full refunds).
currencyCURRENCYISO 4217 currency code.
merchantInternalTransactionCodestringYour idempotency key.
merchantInternalCustomerCodestring | nullYour customer identifier (deprecated field — prefer customer).
storePaymentMethodbooleanWhether the payment method was stored during this transaction.
billing*stringBilling address fields (billingFirstName, billingEmail, etc.).
shipping*stringShipping address fields.
user*stringEnd-user identity fields.
transactionDateDateTimeISOEffective date of the transaction.
startedAtDateTimeISO | nullWhen the transaction was initiated.
succeededAtDateTimeISO | nullWhen the transaction succeeded.
failedAtDateTimeISO | nullWhen the transaction failed.
canceledAtDateTimeISO | nullWhen the transaction was canceled.
disputedAtDateTimeISO | nullWhen a dispute was opened.
refundedAtDateTimeISO | nullWhen the first refund was issued.
voidedAtDateTimeISO | nullWhen the transaction was voided.