I have a customer that is wanting to customize/assign invoice numbers to each receipt/invoice for event registrations rather than the long and completely random ones that CiviCRM puts out and not just for those who select "Pay Later". Is this possible to do? Is it possible to have it reflect for all CiviEvents going forward?

Any help would be greatly appreciated. :)

Using: CiviCRM 4.6.8 Drupal 7

Thank You, Nicole

2 Answers 2


The invoice ID it shouldn't be a random number, I might be wrong but I believe under normal circumstances (unless an extension is already hooking in the contribution entity) the invoice ID is taken from the contribution ID.

As I'm not quite sure what is exactly what you want to achieve, here are some thoughts, I won't elaborate too much.

If what you want is to manually assign a invoice number, you can create a custom field, create a custom token for the given field and edit the invoice template (navigate to Administer - Communication - Message Templates - System Workflow Messages - Invoice receipt) replacing the invoiceID with your custom token.

If you want the custom invoice ID to be generated automatically every time a new contribution is submitted, I don't think there is a straight forward way to do it, as you will need an autoincrement value, and I can't think of an easy way to do that, mysql only allows one autoincrement column per table and when creating a custom filed, Civi creates a new table in the database with a autoincrement column, maybe some of the core team could point you in a better direction.

My thoughts:

  • (a bit of a workaround, maybe not the best way as I said) create a custom field group with an INT text/numeric field, using the appropriate hooks, save that filed in every Contribution submission and copy the value of the ID (autoincrement column) of the custom filed group to the custom filed itself so you can search by invoice id, create the custom token and modify the invoice template.

Hope I explained myself.


Under Admin > CiviContribute > CiviContribute Component Settings, after turning on Sales Tax and Invoices, you have an option to change the prefix of invoices. The number itself is indeed the contribution number, which means it is unique and monotonically increasing.

It wouldn't be too difficult to replace it everywhere with an extension: contribution view, contact dashboard, possibly contact summary contribution tab, find contributions, advanced search, and a bunch of reports would be where I'd start.

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.