Fundraising tech/Transaction IDs

Each financial transaction has IDs associated, with a range of targets and granularities.

trxn vs txn

Civi uses the trxn naming in their database tables. In wmf_contribution_extra though it has gateway_txn_id. This is what is used in the queue messages and throughout our code.

ID Abbreviation Target Granularity Description Example
Contribution Tracking ID CTID per session This is the largest granularity association, and spans all attempts made by this donor until we cut them off for being frustrating.

Ingenico: also at transaction.Merchant Reference

CiviCRM Contribution ID per completed payment The local CRM ID, only assigned once a donation is recorded in our system. You can search for this ID (and the Contact ID) in the quicksearch box in the top-left corner of the page.
CiviCRM Transaction ID civicrm_contribution.trxn_id per completed payment This is another CRM local ID, usually based on the gateway name, gateway transaction ID and a timestamp or other sequence fields when necessary to guarantee uniqueness.
Gateway Transaction ID wmf_contribution_extra.gateway_txn_id depends on gateway Processor's ID for this transaction. This has different meanings depending on the processor (see below). Ingenico:


Ingenico Order ID

GLOBALCOLLECT Recurring payments share the same Order ID, so we append the Effort ID when creating a local Transaction ID.

PayPal Transaction ID


Adyen ...

Amazon ...

AstroPay ...


Recurring? RECURRING ... Term in civicrm_contribution.trxn_id N/A This is a flag in trxn_id to let us know that payments are part of a subscription.
Refund? RFD ... Term in civicrm_contribution.trxn_id N/A Flag to let us know that the payment was a refund. In the distant past we had to create a separate contribution with a negative amount in order to record refunds. Nowadays we just set the contribution_status_id to 9 (Refunded). We will create a separate contribution with transaction prefix RFD if for some reason (currency fluctuation, perhaps) we have to refund more than the original amount.
CiviCRM Invoice ID civicrm_contribution.invoice_id Contribution Tracking ID plus a sequence indicator (incremented on each attempt with the same CT ID). Usually separated by a '.', except for Amazon Pay which uses a '-' due to allowed character restrictions.

Ingenico: Merchant Reference

Gateway Subscription ID FIXME: Start a custom table for this, or make the trxn_id transformation reversible?
CiviCRM Recurring Contribution ID Foreign key for civicrm_contribution.contribution_recur_id
CiviCRM Subscription ID civicrm_contribution_recur.trxn_id We make a unique key from the Gateway Subscription ID, usually by prefixing with the gateway name, but this hasn't been standardized yet.

Ingenico Tokenized subscriptions do not have the gateway name prefixed

Updonate subscriptions do


Updonate: INGENICO 123

CiviCRM Processor ID civicrm_contribution_recur.processor_id Gateway Subscription ID 123
CiviCRM recurring Invoice ID civicrm_contribution_recur.invoice_id Currently not used