During some auditing of membership payments earlier today, we found an interesting error message on one of our members:

iATS Payments Recurring Contribution (id=nnn) Errors: Recur id nnn is has a mismatched contact id for the customer code.

There's one of these messages per day for the last week or so. The original payment did go through, we can see that on both sides (Civi and iATS). The errored attempts aren't getting sent through to iATS (which is probably a good thing).

  • How do I go about finding the details of the recurring payment so I can compare both sides? I've found what is likely the customer record on the iATS side, but that's only showing me the customer code.
  • Alternately, what exactly is being compared and found wanting here, and how possibly did it get messed up?

Thanks in advance for any assistance!

  • We added some additional paranoia in the CiviCRM iATS Extension so we store the contact id associated with the tokenized credit card (iats customer code) and flag it (pop up this error message) - when they no longer match. Oct 5, 2019 at 12:20

2 Answers 2


Table civicrm_iats_customer_codes does not have the correct Customer id to match what iATS has on file. This is likely because you edited or merged the customer at some point and something got messed up in the process. You can use the iATS web portal to view what customer code (I know you said you found it already--but the next person might not know where to find it) iATS has associated with that donation. You can look under reports for the donation or in the Virtual Terminal for the customer name. You can use the API Explorer to find what civi has for the iATS customer id in the civicrm_iatscustomer_codes table. I used the settings below to find what customer ID is currently in Civi. Locate the invoice id associated with the failed transactions. Then search for that. Click the Execute button and search for "cstc": "AXXXXXXXX",in the returned data. WARNING; you can change your data via the API so poke around in there with caution. Generally a Get action should be safe but create, edit, or replace actions will make changes. enter image description here

To fix the problem you will need to change the Customer Code for that entry in your civicrm_iats_customer_code table so it matches what iATS. iATS does not let you edit the customer code at their end so you have to do it on the civi end.

  • Thanks for this, cool that you're using the api in this way! Not quite the right answer to this specific issue, though.
    – Alan Dixon
    Oct 8, 2019 at 19:30

This sanity test and message is generated within the extension during the recurring payment job, as a precaution before talking to the iATS server. It doesn't depend on the customer record saved on the iATS server, and changing that won't have any effect.

For details see line 240 of this file: https://github.com/iATSPayments/com.iatspayments.civicrm/blob/1.6.2/api/v3/Job/Iatsrecurringcontributions.php

The extension itself saves the id of the original contact that signs up and saves it in the table, and compares it before generating/running a recurring contribution. When you merge contacts, it should update the contact id in the iats table, so merging will not normally generate this issue.

A more likely source of the problem is if you've been doing some kind of import of your recurring contribution data and not setting the contact id correctly.

To correct it, you just need to update the cid field in the table civicrm_iats_customer_codes to match the corresponding contact for the recurring contribution.

There is also an email address in this table which is sometimes useful as a reference to help you track down the real donor - looking at the record on the iATS server might also help if you need a name, etc.

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.