1

Using a fairly generic CiviCRM contribution page with membership (CiviCRM 5.19.4 + Drupal 7) and CiviDiscount (3.7).

When a 100% discount code is used, instead of completing, the above error is returned from line 2500 of CRM/Contribute/Form/Contribution/Confirm.php, which is an api call.

The api call is to "completetransaction", with values:

[id] => 1550
[trxn_id] => 
[payment_processor_id] => 3
[is_transactional] => 
[fee_amount] => 
[receive_date] => 
[card_type_id] => 
[pan_truncation] => 
[version] => 3

Since the spec for this api call doesn't include entity_id, presumably this is cascading from a separate api call with the complete transaction.

The contribution is left as incomplete.

3
  • Does kind of errors are quite hard to debug. Unless you have someting as XDEBUG enabled then you can step through your code and see where exactly it is failing. The logs might also help but not sure if it does. And/Or it might be also caused by an extension. Commented Dec 12, 2019 at 6:48
  • Alan-- were you able to track this down? We are now getting the Mandatory key(s) missing from params array: entity_id error. It seems like it might be connected to our recent MySQL upgrade.
    – Larry K.
    Commented Sep 7, 2021 at 14:17
  • TBH, I don't even remember posting this, it was so long ago. Getting the trace of the error is probably key - the error seems to be coming from somewhere further down the stack and not getting handled so it's just showing up later on where it's not very clear why. I'm not clear how a mysql upgrade would trigger something like this, but maybe.
    – Alan Dixon
    Commented Sep 9, 2021 at 17:24

1 Answer 1

2

This one came up again for me so I set up some tracing. The error comes when the completetransaction api call tries to create a EntityFinancialTrxn, but there's no entity id. This is now with CiviCRM ver 5.49.5, CiviDiscount3.8.7

Here's the argument to the entity create call, which gets triggered as part of the completetransaction api call.

 [entity_table] => civicrm_financial_item
 [financial_trxn_id] => 6745
 [entity_id] => 
 [amount] => 0
 [version] => 3

I notice that in spite of the error, a valid pending contribution is created, and that it can be manually completed without error.

When I look at that successful manual completion and compare, I can see that the failed completetransaction is failing at the point where it should have already created an entry in civicrm_financial_trxn - it needs to do that so that there's an id that can go in the civicrm_entity_financial_trxn as the entity id.

Since these are empty/dummy 'financial transactions', I suspect some logic somewhere in the financial system that's deciding it doesn't need to add an empty financial transaction.

Taking a different approach, I tried commenting out the completetransaction call in the Confirm.php page and discovered it tries twice to complete it, both times with notes about this being a bit of a kludge for membership edge cases.

After commenting both out, the UX no longer reports the error, though the contribution remains incomplete in the backend.

Conclusion: the completetransaction api seems to be where this needs fixing.

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.