Upon calling the API's contribution.repeattransaction, the original contribution record seems to get copied correctly, with the exception of invoice_id. Here is what I'm doing:

$result = civicrm_api3('Contribution', 'repeattransaction', array( 'sequential' => 1, 'original_contribution_id' => $original_contribution['id'], 'contribution_status_id' => "Completed", 'trxn_id' => $transaction_id, //Insert new transaction ID ));

This copies the original contribution values and properly inserts the new transaction ID. However, invoice_id is NULL in the database.

If I try to pass invoice_id...

$result = civicrm_api3('Contribution', 'repeattransaction', array( 'sequential' => 1, 'original_contribution_id' => $original_contribution['id'], 'contribution_status_id' => "Completed", 'trxn_id' => $transaction_id, //Insert new transaction ID 'invoice_id' => $new_invoice_id //and new invoice ID ));

...nothing changes. In the civicrm_contribution table, invoice_id is again NULL for the contribution that was just inserted.

Does anyone know how I'm supposed to repeat the transaction and set invoice_id properly?

P.S. I've been looking inside CRM_Core_Payment_BaseIPN->completeTransaction(), but can't see where the invoice_id is handled (if it is).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.