CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • When is a contribution's invoice ID created?
Pages: [1]

Author Topic: When is a contribution's invoice ID created?  (Read 1880 times)

mtmorris000

  • Guest
When is a contribution's invoice ID created?
December 07, 2007, 10:09:04 am
All,

I'm looking for information about the creation of the invoice ID on contributions.  Where in the process is that generated and saved with the contribution?  Upon successful entry of the contribution? 

The problem I'm facing is that I want to pass the invoice ID into our payment processor.  This will allow multiple transactions to be made in quick succession for the same amount.  Currently, our payment processor (PayJunction) does a security check to prevent a card from getting charged twice by mistake, etc.  If we can pass a unique invoice ID, that check will be skipped.  But, I'm not sure if we have the invoice number at that point - when the payment is being performed, before the contribution is committed as a successful transaction.

Likewise, via an alternate donation path, we insert contributions into Civi using the Contribution API.  We'd also like to be able to pre-generate the invoice before processing the payment, for the same reason.

Does anyone have any insight into this?

Thanks,
Mike

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: When is a contribution's invoice ID created?
December 08, 2007, 07:32:24 am

You do have an invoiceID at that point. We use the same technique for paypal. invoiceID will be part of the params. We initialize it in CRM/Contribute/Form/Contribution/Main.php (i.e. when the person loads the page the first time)

Code: [Select]
       // generate and set an invoiceID for this transaction                                                               
        $invoiceID = $this->get( 'invoiceID' );
        if ( ! $invoiceID ) {
            $invoiceID = md5(uniqid(rand(), true));
        }
        $this->set( 'invoiceID', $invoiceID );


A payment processor can then use: $params['invoiceID'] in the payment routines (check PayPalImpl.php)

lobo

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • When is a contribution's invoice ID created?

This forum was archived on 2017-11-26.