Answers.Body: <p>I dug into the code:</p>
  
  <p>Firstly, in my humble view, it could use splitting into separate functions. One function is almost 400 lines long, making investigation hard.</p>
  
  <p>I think I've seen the problem though. If your version of civicrm is less than 4.7.12, it won't activate a lot of the logic for recurring contributions. </p>
  
  <p><a href="https://github.com/iATSPayments/com.iatspayments.civicrm/blob/a92dd620a8975469e65372b3e34c812e5130faa1/iats.php#L244" rel="nofollow noreferrer">https://github.com/iATSPayments/com.iatspayments.civicrm/blob/a92dd620a8975469e65372b3e34c812e5130faa1/iats.php#L244</a></p>
  
  <p><code>function _iats_civicrm_use_repeattransaction() {
    $version = CRM_Utils_System::version();
    return (version_compare($version, '4.7.12') &lt; 0) ? FALSE : TRUE;
  }</code></p>
  
  <p>For example, line 1425, which decides if to use line 1448, which currently reads:</p>
  
  <p><code>$complete['is_email_receipt'] = empty($options['is_email_receipt']) ? 0 : 1;
  try {
    $contributionResult = civicrm_api3('contribution', 'completetransaction', $complete);
  }</code></p>
  
  <p><strong>Update</strong>
  Oh, and there are also two unmerged patches from solid contributors: 
  <a href="https://github.com/iATSPayments/com.iatspayments.civicrm/pulls" rel="nofollow noreferrer">https://github.com/iATSPayments/com.iatspayments.civicrm/pulls</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-16T17:19:29.713Z
Answers.Text: We upgraded to 4.7.17 (still not fully supported by iATS but I decided to try it)  and I made a non-recurring donation and did not receive a receipt for it.  I am assuming I will get the receipt once the transaction clears my bank which is how the system should work.
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-16T23:34:46.773Z
Answers.Text: @CarlMiller neat! Drop me a line at john@civifirst.com to discuss fixing it up properly.
Answers.UserDisplayName: JohnFF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-15T23:01:33.770Z
Answers.LastActivityDate: 2017-03-15T23:21:45.083Z
Answers.LastEditDate: 2017-03-15T23:21:45.083Z
Answers.UserDisplayName: JohnFF
Body: <p>Wordpress 4.7.3
  Civi 4.6.26
  iATS Payments for our processor</p>
  
  <p>When donors make an ACH donation they get receipt right away and then a second one when the it clears their bank and the donation in Civi is changed from Pending to Completed. Is there a way to have Civi only send one receipt?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-15T03:06:55.410Z
Comments.Text: Very interested in this question. Happens to us as well. See http://civicrm.stackexchange.com/q/14233/105
Comments.UserDisplayName: Allen Hutchison
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-15T15:44:29.253Z
Comments.Text: I have been looking at when receipts have been sent and found a little more info that may help.  First time recurring ACH donations receive no receipt until the donation clears the donors bank. ACH donations that are not recurring, receive a receipt at the time of the donation and a second receipt when the donation clears the donors bank.
Comments.UserDisplayName: Iowa Boy
Tags: <receipts><iats>
Title: Donors are receiving multiple receipts with ACH contributions
ThreadText: # Donors are receiving multiple receipts with ACH contributions
  
  (Asked by: username_0 on 2017-03-14)
  
  Wordpress 4.7.3
  Civi 4.6.26
  iATS Payments for our processor
  
  When donors make an ACH donation they get receipt right away and then a second one when the it clears their bank and the donation in Civi is changed from Pending to Completed. Is there a way to have Civi only send one receipt?
  
  **Tags:** receipts, iats
  
  > **Comments:**
  > **username_1**: Very interested in this question. Happens to us as well. See http://civicrm.stackexchange.com/q/14233/105  
  > **username_0**: I have been looking at when receipts have been sent and found a little more info that may help.  First time recurring ACH donations receive no receipt until the donation clears the donors bank. ACH donations that are not recurring, receive a receipt at the time of the donation and a second receipt when the donation clears the donors bank.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-03-15. Score: 1 | Accepted answer
  
  I dug into the code:
  
  Firstly, in my humble view, it could use splitting into separate functions. One function is almost 400 lines long, making investigation hard.
  
  I think I've seen the problem though. If your version of civicrm is less than 4.7.12, it won't activate a lot of the logic for recurring contributions.
  
  <https://github.com/iATSPayments/com.iatspayments.civicrm/blob/a92dd620a8975469e65372b3e34c812e5130faa1/iats.php#L244>
  
  `function _iats_civicrm_use_repeattransaction() {
  $version = CRM_Utils_System::version();
  return (version_compare($version, '4.7.12') < 0) ? FALSE : TRUE;
  }`
  
  For example, line 1425, which decides if to use line 1448, which currently reads:
  
  `$complete['is_email_receipt'] = empty($options['is_email_receipt']) ? 0 : 1;
  try {
  $contributionResult = civicrm_api3('contribution', 'completetransaction', $complete);
  }`
  
  **Update**
  Oh, and there are also two unmerged patches from solid contributors:
  <https://github.com/iATSPayments/com.iatspayments.civicrm/pulls>
  
  > **Comments:**
  > **username_0**: We upgraded to 4.7.17 (still not fully supported by iATS but I decided to try it)  and I made a non-recurring donation and did not receive a receipt for it.  I am assuming I will get the receipt once the transaction clears my bank which is how the system should work.  
  > **username_2**: @CarlMiller neat! Drop me a line at john@civifirst.com to discuss fixing it up properly.  
  
  ---
  
  