My customer wants a different Invoice ID numbering.

A sequence based on year and contribution type.

So, something like Event-2015-001 Event-2015-002 .. Event-2015-156 Event-2016-001 Memb-2015-001 Memb-2015-002 .. Memb-2015-129 Memb-2016-001

How would you approach that? What are the (unwanted) side-effects?

The invoices are generated by CiviCRM (so not an external source of the Invoice ID). The invoice ID's will be used by a financial package.

Thanks for the answers. After I showed the customer that Invoice ID's were adjustable with Batch Update Contributions via Profile they want to use that for now. Maybe later we will automate it.

  • Can you explain a little more about the overall process? What are you doing that originates the invoice? This will help others to understand your problem and the answer you will get :-) Dec 17, 2015 at 15:32
  • Adjusted the question a bit
    – Catorghans
    Dec 17, 2015 at 15:48
  • What are the unwanted side-effects? The invoice-id is used by payment processors for different tasks: See issues.civicrm.org/jira/browse/CRM-20387 Apr 16, 2017 at 14:09
  • 1
    I won't pretend to understand Civi's invoicing system - but I saw something that seems relevant in my Github feed, where the human-readable invoice ID is going to be a separate field from the internal invoice ID. I believe that this will make what you're describing possible, or at least get you most of the way there: github.com/civicrm/civicrm-core/pull/10298 Jun 14, 2017 at 17:06
  • probably useful to add your own answer as an Answer and +1 it
    – petednz - fuzion
    Jul 15, 2017 at 23:31

3 Answers 3


I think the answer is in the making: Klaas and Björn just proposed this PR: https://github.com/civicrm/civicrm-core/pull/11110

  • Yes, the new hook proposed in CRM-21289 would exactly cover this scenario. Just waiting for it to be accepted... Björn. Oct 17, 2017 at 7:30
  • I gave it my thumbs up 👍 Oct 17, 2017 at 12:56
  • Any news on this? My client wants to use invoices, but wants to use their own invoice numbering system.
    – Graham
    Jan 17, 2018 at 11:09

Where exactly is the invoiceID generated? I am not aware of any invoiceID generated automatically but that may well be my bad :-) If there is an invoice generated I would imagine you would be able to use the hook_civicrm_pre or if not the hook_civicrm_post on the Entity ParticipantPayment to catch and change the invoice ID?

  • Invoicing was added in CiviCRM 4.6 - civicrm.org/blogs/tonymazz/… Dec 18, 2015 at 15:06
  • Thanks William :-) Hans, did you try with the civicrm_pre hook? Dec 20, 2015 at 14:20
  • 1
    Hoi Erik! invoice_id generation was added by Lobo a decade ago :-) It has been sent to payment processors - just about any of them for what must amount to millions of transactions; the 4.6 invoicing feature accidentally repurposed that field - that's now being separated out by Coleman. Jun 14, 2017 at 20:10
  • Hoi Karin, I know about the invoice_id by now :-). One of the problems we are facing is that most of our customers want their own numbering system, and the 4.6 invoice id generation does not call any hook unfortunately! But moving house right now......:-) Jun 19, 2017 at 18:44

Not a full answer but hope gives some insights.

The invoice ID is taken from the contribution ID, that said, I would rather go for a custom filed/extension. I do remember that contribution ID AND invoice ID (when applicable) is used to check against existing contributions, not 100% sure about this but perhaps someone from the core team could clarify.

There was a similar question 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.