Answers.Body: <p>Adding a patch for the error you facing, the patch fix the problem</p>
  <pre><code>diff --git a/includes/wf_crm_webform_postprocess.inc b/includes/wf_crm_webform_postprocess.inc
  index 8a9995a..5b0437d 100644
  --- a/includes/wf_crm_webform_postprocess.inc
  +++ b/includes/wf_crm_webform_postprocess.inc
  @@ -2183,10 +2183,24 @@ class wf_crm_webform_postprocess extends wf_crm_webform_base {
         if (empty($item['contribution_id'])) {
           $item['contribution_id'] = $id;
         }
  -      $priceSetId = 'default_contribution_amount';
  +
  +      $priceFieldValueParams = [
  +        'return' =&gt; ['id', 'price_field_id'],
  +        'price_field_id.price_set_id' =&gt; 'default_contribution_amount',
  +        'price_field_id.is_active' =&gt; 1,
  +        'options' =&gt; ['limit' =&gt; 1],
  +        'price_field_id.name' =&gt; 'contribution_amount',
  +      ];
  +
         // Membership
         if (!empty($item['membership_id'])) {
  -        $priceSetId = 'default_membership_type_amount';
  +        $priceFieldValueParams['price_field_id.price_set_id'] = 'default_membership_type_amount';
  +        $priceFieldValueParams['membership_type_id'] = wf_civicrm_api('Membership', 'getvalue', [
  +          'return' =&gt; 'membership_type_id',
  +          'id' =&gt; $item['membership_id'],
  +        ]);
  +        unset($priceFieldValueParams['price_field_id.name']);
  +
           $item['entity_id'] = $item['membership_id'];
           $lineItemArray = wf_civicrm_api('LineItem', 'get', [
             'entity_table' =&gt; &quot;civicrm_membership&quot;,
  @@ -2204,11 +2218,10 @@ class wf_crm_webform_postprocess extends wf_crm_webform_base {
             }
           }
         }
  -      $item['price_field_id'] = wf_civicrm_api('PriceField', 'get', [
  -        'sequential' =&gt; 1,
  -        'price_set_id' =&gt; $priceSetId,
  -        'options' =&gt; ['limit' =&gt; 1],
  -      ])['id'] ?? NULL;
  +
  +      $priceFieldValue = wf_civicrm_api('PriceFieldValue', 'getsingle', $priceFieldValueParams);
  +      $item['price_field_id'] = $priceFieldValue['price_field_id'];
  +      $item['price_field_value_id'] = $priceFieldValue['id'];
   
         // Save the line_item
         $line_result = wf_civicrm_api('line_item', 'create', $item);
  
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-27T15:26:48.600Z
Answers.LastActivityDate: 2023-01-27T15:26:48.600Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>CiviCRM 5.51.3, Drupal 7.92, Webform 7.x-4.24, Webform-CiviCRM integration 7.x-5.8.</p>
  <p>Since the upgrade from 5.45.7 to 5.51.3, we have been unable to submit a donation successfully via a webform.  These are the two errors that result:</p>
  <p>The CiviCRM &quot;line_item create&quot; API returned the error: &quot;One of parameters (value: ) is not of the type Integer&quot; when called by function &quot;postSave&quot; on line 234 of wf_crm_webform_postprocess.inc with parameters: &quot;Array ( [qty] =&gt; 1 [unit_price] =&gt; 2.7 [financial_type_id] =&gt; 1 [label] =&gt; Contribution Amount [element] =&gt; civicrm_1_contribution_1 [entity_table] =&gt; civicrm_contribution [line_total] =&gt; 2.7 [entity_id] =&gt; 62880 [contribution_id] =&gt; 62880 [price_field_id] =&gt; 915 [check_permissions] =&gt; [version] =&gt; 3 ) &quot;</p>
  <p>TypeError: CRM_Financial_BAO_Order::getPriceSetID(): Return value must be of type int, null returned in CRM_Financial_BAO_Order-&gt;getPriceSetID() (line 461 of /var/www/wwwadmin/data/www/XXXXXXXX/sites/all/modules/civicrm/CRM/Financial/BAO/Order.php).</p>
  <p>Per other questions/answers posted here on SE, I've checked to confirm that:</p>
  <p>a) the financial type in question is correctly tied to the appropriate accounts (it is)</p>
  <p>b) all line items have a populated price_field_value_id field (they do)</p>
  <p>c) the default contribution price field, price field value, and price set exist (they do)</p>
  <p>I'm stumped as to where to go next with this.  Any ideas/suggestions would be most welcome.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-15T14:49:36.783Z
Comments.Text: Why does the param don't have price_field_value_id? Can you check if you are using the correct price sets? Is 915 price field id of price set default_contribution_amount?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-16T14:10:48.693Z
Comments.Text: There's no way to link price sets to webforms of which I'm aware... and yes, 915 is the price field ID of the default_contribution_amount.
Comments.UserDisplayName: Lesley Carter - BackOffice
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-22T15:55:17.143Z
Comments.Text: are you still facing the problem?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-01T20:57:08.223Z
Comments.Text: Yes, we are.  We've temporarily pivoted to a Civi contribution page because we've been unable to resolve this.
Comments.UserDisplayName: Lesley Carter - BackOffice
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-03T01:17:56.900Z
Comments.Text: It's a web form issue, do you want a fix for the webform code?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-05T12:31:01.677Z
Comments.Text: If there is one available to which you can point me, that would be super helpful.
Comments.UserDisplayName: Lesley Carter - BackOffice
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-05T12:40:52.467Z
Comments.Text: Unfortunately there isn't one, so was thinking to push a fix but need some volunteer to do testing
Comments.UserDisplayName: Pradeep Nayak
Tags: <webform-civicrm><contributions>
Title: Issue with CiviCRM webform donation
ThreadText: # Issue with CiviCRM webform donation
  
  (Asked by: username_0 on 2022-11-09)
  
  CiviCRM 5.51.3, Drupal 7.92, Webform 7.x-4.24, Webform-CiviCRM integration 7.x-5.8.
  
  Since the upgrade from 5.45.7 to 5.51.3, we have been unable to submit a donation successfully via a webform. These are the two errors that result:
  
  The CiviCRM "line\_item create" API returned the error: "One of parameters (value: ) is not of the type Integer" when called by function "postSave" on line 234 of wf\_crm\_webform\_postprocess.inc with parameters: "Array ( [qty] => 1 [unit\_price] => 2.7 [financial\_type\_id] => 1 [label] => Contribution Amount [element] => civicrm\_1\_contribution\_1 [entity\_table] => civicrm\_contribution [line\_total] => 2.7 [entity\_id] => 62880 [contribution\_id] => 62880 [price\_field\_id] => 915 [check\_permissions] => [version] => 3 ) "
  
  TypeError: CRM\_Financial\_BAO\_Order::getPriceSetID(): Return value must be of type int, null returned in CRM\_Financial\_BAO\_Order->getPriceSetID() (line 461 of /var/www/wwwadmin/data/www/XXXXXXXX/sites/all/modules/civicrm/CRM/Financial/BAO/Order.php).
  
  Per other questions/answers posted here on SE, I've checked to confirm that:
  
  a) the financial type in question is correctly tied to the appropriate accounts (it is)
  
  b) all line items have a populated price\_field\_value\_id field (they do)
  
  c) the default contribution price field, price field value, and price set exist (they do)
  
  I'm stumped as to where to go next with this. Any ideas/suggestions would be most welcome.
  
  **Tags:** webform-civicrm, contributions
  
  > **Comments:**
  > **username_1**: Why does the param don't have price_field_value_id? Can you check if you are using the correct price sets? Is 915 price field id of price set default_contribution_amount?  
  > **username_0**: There's no way to link price sets to webforms of which I'm aware... and yes, 915 is the price field ID of the default_contribution_amount.  
  > **username_1**: are you still facing the problem?  
  > **username_0**: Yes, we are.  We've temporarily pivoted to a Civi contribution page because we've been unable to resolve this.  
  > **username_1**: It's a web form issue, do you want a fix for the webform code?  
  > **username_0**: If there is one available to which you can point me, that would be super helpful.  
  > **username_1**: Unfortunately there isn't one, so was thinking to push a fix but need some volunteer to do testing  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-01-27. Score: 0
  
  Adding a patch for the error you facing, the patch fix the problem
  
  ```
  diff --git a/includes/wf_crm_webform_postprocess.inc b/includes/wf_crm_webform_postprocess.inc
  index 8a9995a..5b0437d 100644
  --- a/includes/wf_crm_webform_postprocess.inc
  +++ b/includes/wf_crm_webform_postprocess.inc
  @@ -2183,10 +2183,24 @@ class wf_crm_webform_postprocess extends wf_crm_webform_base {
         if (empty($item['contribution_id'])) {
           $item['contribution_id'] = $id;
         }
  -      $priceSetId = 'default_contribution_amount';
  +
  +      $priceFieldValueParams = [
  +        'return' => ['id', 'price_field_id'],
  +        'price_field_id.price_set_id' => 'default_contribution_amount',
  +        'price_field_id.is_active' => 1,
  +        'options' => ['limit' => 1],
  +        'price_field_id.name' => 'contribution_amount',
  +      ];
  +
         // Membership
         if (!empty($item['membership_id'])) {
  -        $priceSetId = 'default_membership_type_amount';
  +        $priceFieldValueParams['price_field_id.price_set_id'] = 'default_membership_type_amount';
  +        $priceFieldValueParams['membership_type_id'] = wf_civicrm_api('Membership', 'getvalue', [
  +          'return' => 'membership_type_id',
  +          'id' => $item['membership_id'],
  +        ]);
  +        unset($priceFieldValueParams['price_field_id.name']);
  +
           $item['entity_id'] = $item['membership_id'];
           $lineItemArray = wf_civicrm_api('LineItem', 'get', [
             'entity_table' => "civicrm_membership",
  @@ -2204,11 +2218,10 @@ class wf_crm_webform_postprocess extends wf_crm_webform_base {
             }
           }
         }
  -      $item['price_field_id'] = wf_civicrm_api('PriceField', 'get', [
  -        'sequential' => 1,
  -        'price_set_id' => $priceSetId,
  -        'options' => ['limit' => 1],
  -      ])['id'] ?? NULL;
  +
  +      $priceFieldValue = wf_civicrm_api('PriceFieldValue', 'getsingle', $priceFieldValueParams);
  +      $item['price_field_id'] = $priceFieldValue['price_field_id'];
  +      $item['price_field_value_id'] = $priceFieldValue['id'];
   
         // Save the line_item
         $line_result = wf_civicrm_api('line_item', 'create', $item);
  
  ```
  
  
  ---
  
  