1.0 Problem/Motivation

Seemingly after updating CiviCRM to 5.50.3 and webform_civicrm to 7.x-5.8 on drupal 7.83, webform payments fail. Watchdog says

```
The CiviCRM "contribution transact" API returned the error: "Unknown api version" when called by function "validate" on line 97 of wf_crm_webform_postprocess.inc with parameters: "Array ( [credit_card_type] => MasterCard [credit_card_number] => xxxxxxxxxx...[snip][form_token] => qnqM4nlUWJSVIPZiCsb57jdigsIZ76jGiG0Aa9a6nyc [form_id] => webform_client_form_2556 [op] => Submit [payment_instrument_id] => 1 [payment_processor] => 5 [card_type_id] => 2 [pan_truncation] => 7947 [check_permissions] => [version] => 3 )
```

As a result, it appears everything to be handled after payment is not done, storing the payment in civicrm, sending mails/invoices, adding contacts to groups, etc - however, strangely, the payment seems to have been done.

2.0 Detailed steps to reproduce (embed screenshots)

Submit any form with a webform payment. I'd rather not include screenshots.

3.0 Proposed resolution

Assuming this string "Unknown api version" comes from Civi/API/Request.php,
https://lab.civicrm.org/dev/core/-/blob/fb87724ca7f9fd42560e0729e9e46a3c...

it seems `$params['version']` is not 3 or 4.

It is clear in the error message version is either 3 or '3' - I can't see where the value comes from in `function contributionParams` - if it comes from a post, it might be a string?

Comments

commonpike created an issue. See original summary.

commonpike’s picture

Issue summary: View changes
commonpike’s picture

From testing on a dev environment, it appears the 'version' is '' - so the error message is wrong

installing https://lab.civicrm.org/extensions/mjwshared and https://lab.civicrm.org/extensions/contributiontransactlegacy

as suggested here

https://civicrm.stackexchange.com/questions/42236/payment-forms-fail-wit...

does seem to change things. on the dev environment, I now get a more sensible error and the transaction are properly marked as 'failed' in civicrm. this may be because of the dev environment.

two questions:

- I am hesitant to test these extensions on live. is there anything else I need to configure to get wf_civicrm to connect with them ?
- are these extensions required ? how could I have known ?

commonpike’s picture

No, I have the same errors on Live. It seems the error comes from

civicrm/CRM/Core/Payment/AuthorizeNet.php::170

```
if ($this->checkDupe($authorizeNetFields['x_invoice_num'], $params['contributionID'] ?? NULL)) {
throw new PaymentProcessorException('It appears that this transaction is a duplicate.....
```

Likely this problem was introduced by https://lab.civicrm.org/extensions/contributiontransactlegacy

MegaphoneJon’s picture

@commonpike see if https://github.com/civicrm/civicrm-core/pull/25020 solves this for you?