Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-5454

InvoiceID should be regenerated on submission of Main.php

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Blocker
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.0.3
    • Component/s: CiviContribute
    • Labels:
      None

      Description

      Currently, an order's invoiceID is generated once upon first submission of CRM/Contribute/Form/Main.php::postProcess().

      If a user proceeds to the checkout and submits their order for processing, but for one reason or another the payment processor denies the transaction and the order fails, the user will be sent back to Main.php from where they can correct their error and try and submit again. However, on further submissions of the form the invoiceID in not regenerated, and the same ID is sent to the payment processor each time. Some payment processors (I know that Realex and Authorize.net do this) will see the order as a 'duplicate' and flat out deny it on all future attempts to resubmit. These payment processors 'get round?' this by putting up an error message after all further submission attempts stating 'this order may be a duplicate, please wait a couple of hours and try again'. The only way to get the order successfully submitted to these payment processors is to visit Main.php?reset=1 and start all over again.

      This is not an acceptable solution. This bug has cost several hundreds of transactions for some of the companies that I have worked with, which is why I have marked it as a blocker.

      The fix is very simple, and is attached in the patch (thanks dlobo). It simply generates a new invoiceID every time Main.php is submitted. I have had this tested on a couple of very busy CiviCRM sites for over a week (over £20,000 in £10 - £50 donations taken in this period) and have noticed no problems, and the number of failed transactions has drastically decreased - to almost 0.

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              mrfelton Tom Kirkpatrick
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: