I am trying to import CSV file with a bunch of contributions that I have downloaded from Stripe, but it is requiring that Transaction ID and Invoice ID be unique across all Contributions.

When creating the CSV file (using a script), I will create a seperate line for each item in an individual Stripe transaction.

So if a single transaction on Stripe for $100 shows Building Fund $75 and General Fund $25, then in my CSV file that is generated, I create two seperate lines with basically all identical information except the Amount and the Financial Type. Since both these items come from the same Stripe transaction, they both have the same Transaction ID (I am using Stripe Charge ID for this).

When I try to import the Contributions I get error log file with this: "Duplicate error - existing contribution record(s) have a matching Transaction ID or Invoice ID. Contribution record ID(s) are: 2"

I am importing as INSERT NEW CONTRIBUTIONS and my mapping is match on EMAIL only (I have made sure there are not duplicate emails in my contacts).

Has anybody else come across this issue?

  • i think the issue could be that you are talking about 'import contributions' but then you are talking about 'import line items'. i can't recall if this could help github.com/eileenmcnaughton/nz.co.fuzion.csvimport but i suspect that it would be a two step import. first contribution then line items. happy to learn i am wrong
    – petednz - fuzion
    Jan 22, 2022 at 21:56

4 Answers 4


The error message says TransactionID or InvoiceID not AND as you say in your question.

To get round this I would just edit your CSV so that you add a suffix "-1" "-2" etc to one of these fields where they would otherwise be the same. That way you can still see they are related when you look at them later.

  • I was suggesting that the OR meant that it requires both the Transaction ID AND the Invoice ID to be unique, not from each other, but within their own fields.
    – jsherk
    Jan 23, 2022 at 2:23
  • Reading the error message again I see that your interpretation is correct!
    – Mick Kahn
    Jan 23, 2022 at 8:43

It appears that Transaction ID, Invoice ID and Credit ID are all designed to be unique on a per Contribution basis, and that this is by design.

I suppose its a feature request on my part to have an option where they do not need to be unique.

But in the meantime, the only solution is to make each Transaction ID unique somehow by adding additional text to it like "1of2" and "2of2".

Per Mick Kahn answer!


This is what line items are designed for. The contribution table will have $100 with the transaction id, invoice id etc with a financial type of X (we use Donation). Then the line item table has two entries. One for $75 for Building Fund and another entry of $25 for General Fund. In the import process this requires multiple imports. Once for the contribution table and once for the line item table.

  • I do not see anything related to Import Contributions that allows me to add a line item or to import them as line items instead of just a single contribution. I do not even see any way to add a line item when manually using New Contribution or editing an exising contribution.
    – jsherk
    Jan 24, 2022 at 22:16
  • I used civicrm.org/extensions/api-csv-import-gui But you have to do it in two steps. Do the contribution import first. Then do the line item table and be sure that the contribution id is included.
    – Iowa Boy
    Jan 25, 2022 at 16:44

As mentioned in my comment, this scenario would involve firstly importing the Contribution, then importing the Line Items.

I believe the latter can be achieved using this extension (as in, it says it can import Line Items, but I have never had cause to use it. Seems you can use either the Contribution ID or the Trxn ID or the Invoice ID to run that import

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.