Skip to main content

Reconciliation

Reconciliation is the process of matching AccruPay transaction records to your internal orders and to the line items on your payment provider statements. This page describes the key identifiers, how to export transaction data, and how to handle state lag between AccruPay and the provider.


Key identifiers

Every AccruPay transaction carries several reference fields. Use the right one depending on what you are matching against.

FieldTypeDescriptionUse for
idStringAccruPay UUIDPrimary internal reference; use in all API calls
merchantInternalTransactionCodeStringYour order or transaction ID — you set this when creating the transactionMatching AccruPay records back to your own database
providerCodeStringThe provider's own transaction referenceMatching to line items on a provider statement or dashboard
providerRelatedCodeStringProvider reference for a related transaction (e.g. the original sale when providerCode is a refund)Refund reconciliation — links the refund back to the original charge
providerAuthorizationCodeStringAuthorization code issued by the card networkMatching to a card receipt or chargeback notice

Exporting transactions by date range

Use merchantApiTransactions with date filters to export a batch:

query ExportTransactions(
$from: DateTime!
$to: DateTime!
$take: Int!
$skip: Int!
) {
merchantApiTransactions(
transactionDateFrom: $from
transactionDateTo: $to
take: $take
skip: $skip
) {
edges {
node {
id
merchantInternalTransactionCode
providerCode
providerRelatedCode
providerAuthorizationCode
status
amount
currency
createdAt
updatedAt
}
}
totalCount
pageInfo {
hasNextPage
}
}
}

Variables example

{
"from": "2025-01-01T00:00:00Z",
"to": "2025-01-31T23:59:59Z",
"take": 100,
"skip": 0
}

Cursor pagination for large exports

For statement periods with more than a few hundred transactions, paginate using skip and the totalCount to iterate through all records:

async function exportAllTransactions(from: string, to: string) {
const take = 100;
let skip = 0;
const results = [];

while (true) {
const page = await sdk.transactions.getMany({
transactionDateFrom: from,
transactionDateTo: to,
take,
skip,
});

results.push(...page.edges.map((e) => e.node));

if (!page.pageInfo.hasNextPage) break;
skip += take;
}

return results;
}

Reconciling refunds

When a refund is processed, AccruPay creates a separate transaction with:

  • status: SUCCEEDED (action: REFUND)
  • providerCode: the provider's refund reference
  • providerRelatedCode: the provider's reference for the original charge

To find all refunds for a given original transaction, query by providerRelatedCode equal to the original transaction's providerCode.


Why syncOne() exists

Provider webhook events can arrive late or, rarely, not at all. When this happens:

  • AccruPay's record shows the last known state (e.g. PENDING).
  • The provider dashboard shows the actual current state (e.g. SUCCEEDED).

Calling syncOne() forces AccruPay to query the provider directly and update the record immediately:

mutation SyncTransaction {
merchantApiTransactionSyncOne(
merchantTransactionProviderId: "provider-id"
id: "transaction-id"
) {
id
status
providerCode
updatedAt
}
}

Call syncOne() whenever:

  • A reconciliation run finds a PENDING transaction that should have settled.
  • Your statement shows a charge with no matching SUCCEEDED record in AccruPay.
  • An ACH transaction has been outstanding longer than your provider's settlement window without moving to a terminal state (see ACH Payments for provider-specific timelines).

Reconciliation workflow

  1. Export AccruPay transactions for the statement period using date range pagination.
  2. Match on providerCode to find the same transaction in your provider statement.
  3. Match on merchantInternalTransactionCode to confirm it maps to your internal order.
  4. Flag mismatches: records in AccruPay with no provider statement entry, or statement entries with no AccruPay record.
  5. Call syncOne() for any AccruPay records still in PENDING to pull the latest state.
  6. For refunds: use providerRelatedCode to confirm the refund is linked to the correct original charge.

  • Webhooks — how provider events flow into AccruPay
  • Transactions API — query and sync operations
  • Errors — understanding providerError on failed transactions