Answers.Body: <p>Price set options that change are doable, but in order to make the totaling work, you've got to rewrite that bit of code, because it adds and subtracts the single item amount you check or uncheck.</p>
  
  <p>Let's say the fee price option is pegged at 3%. You select $50, the fee option goes up to $1.50 and the total goes to $50. Now, you check the cover-my-fee box, bringing the total to $51.50. You decide to be more generous and select $100. The fee option goes up to $3, but it won't appear to take effect because the totaling only counts the change from $50 to $100. Your total will say $101.50.  Now, you decide that if you're donating all that money, the least the organization can do is cover the fee.  Uncheck the fee option, and the total goes to $98.50.  It subtracts the option amount regardless of whether that's in the total.</p>
  
  <p>The solution to this is to rewrite that javascript to total the entire thing each time something changes.</p>
  
  <p>Hook_civicrm_buildAmount will take care of the amounts on the confirmation page since by that point, you'll know what options are selected.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-25T15:47:45.677Z
Answers.Text: Thanks for this, Andrew! I'll put it in my "rainy day" list of things to experiment with. Do you know off-hand whether post-processing on a webform_civicrm form would work?
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-25T16:06:24.823Z
Answers.Text: Ooh--haven't tried that.  I bet it would work, but I don't know what you'd be changing on the webform vs. anything in CiviCRM.
Answers.UserDisplayName: Andie Hunt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-11T16:39:16.977Z
Answers.Text: I'd like to try to implement this, but I'm not seeing how to "peg" a price option to a percentage. Is that an admin-accessible option, or is it only code-able?Also, would there be a way to implement CiviDiscount to handle this sort of thing? For instance, create a negative discount applicable only to Contributions, and instead of having the "apply discount" field at the top of the contribution page, have it as a check box right above the "Total Amount."
  
  (I'm open to moving this to a new question, if that makes more sense. I'm not sure.)
Answers.UserDisplayName: Phil Morice Brubaker
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-11T18:57:16.447Z
Answers.Text: It would be in custom code. Price options out-of-the-box are only fixed prices.
Answers.UserDisplayName: Andie Hunt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-25T11:48:43.497Z
Answers.LastActivityDate: 2015-03-25T11:48:43.497Z
Answers.UserDisplayName: Andie Hunt
Answers.Body: <p>The best way to achieve this would be to use price-sets and add the priceset item with the amount of the processing fees. When you have multiple donation amount options, it could be issue, but I think can be achieved via hook alter. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-30T02:08:59.110Z
Answers.Text: Yes, but I believe the op is looking to calculate a percentage.  This will work if fixed.  Also, you must make it a required option.
Answers.UserDisplayName: Sonicthoughts
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-25T03:53:28.780Z
Answers.LastActivityDate: 2015-03-25T03:53:28.780Z
Answers.UserDisplayName: rahulbile
Answers.Body: <p>Another extension to consider with a slightly different approach from <em>Percentage Price Field</em> is Fuzion's <em>Extra Fee</em> extension.</p>
  <ul>
  <li><a href="https://github.com/fuzionnz/nz.co.fuzion.extrafee" rel="nofollow noreferrer">https://github.com/fuzionnz/nz.co.fuzion.extrafee</a></li>
  </ul>
  <blockquote>
  <p>This extension allows for a credit card fee and optional processing fee for the CC payment to be added to the total to be paid via any payment processor that uses Credit Cards or other payment gateways. It does not get applied for Pay Later transactions.</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-08T02:32:33.553Z
Answers.LastActivityDate: 2020-08-08T02:32:33.553Z
Answers.UserDisplayName: Laryn
Answers.Body: <p>It's pretty late to be answering this, but the <em>Percentage Price Field</em> extension supports something very much like this.</p>
  
  <blockquote>
    <p>This extension allows you to add an "Additional Percentage" field to
    any price set, which will automatically calculate and add an
    additional amount to a transaction, as a configurable percentage of
    other selected price set options.</p>
    
    <p>Want to ask donors to give an extra 3% to cover credit card processing
    fees? Or to give an additional 10% of their membership fee to support
    a special project?   Then you're in the right place.</p>
    
    <p>Because it's a price set field, this option will appear as a line item
    in contribution records and receipts, allow configuration of financial
    type, label, help text, and other standard price field options, and
    work equally well for contributions, memberships, events -- anywhere
    you can use a price set.</p>
  </blockquote>
  
  <p><a href="https://civicrm.org/extensions/percentage-price-field" rel="noreferrer">https://civicrm.org/extensions/percentage-price-field</a></p>
  
  <p>[Disclosure: I'm the author of this extension.]</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-23T03:50:29.183Z
Answers.Text: A nice feature would be if it could fully calculate the proper fee.  For example, with a typical processor, a fee might be $0.30 + 2.9%, the equation would be total=(subtotal+.3)/(1-.029).
Answers.UserDisplayName: Dave
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-23T16:57:36.030Z
Answers.Text: Thanks @Dave. I'm open to that; see https://github.com/twomice/com.joineryhq.percentagepricesetfield/issues/14
Answers.UserDisplayName: TwoMice
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-14T16:39:47.553Z
Answers.LastActivityDate: 2016-10-14T16:39:47.553Z
Answers.UserDisplayName: TwoMice
Body: <p>I've seen other systems that allow the donor to check a box to cover processing costs, similar to this:</p>
  
  <p><img src="https://i.sstatic.net/5h2qI.jpg" alt="Cover processing fees"></p>
  
  <p>In researching whether something like this was possible with CiviCRM, <a href="http://forum.civicrm.org/index.php?topic=33098.0" rel="noreferrer">this thread</a> is the closest I've found. The solution there is to simply put a flat rate additional amount.</p>
  
  <p>I'd love some guidance on how this could be implemented more dynamically (so the amount of the fee changes based on the size of the donation) as either a default contribution page, or a Webform-CiviCRM implementation. Anyone have an idea?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-10T04:51:07.953Z
Comments.Text: My organization would also be interested in such a feature. We use Joomla, so I'd be sad if it were implemented using drupal webforms.
Comments.UserDisplayName: Phil Morice Brubaker
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-08T04:35:27.650Z
Comments.Text: I do have sites where we do this with Webform CiviCRM module -> in D7WFC you’ll need Webform Calculator module (ask me for about a slightly improved fork if you’re thinking of this); in D8WFC -> Webform D8 has native computed Twig Elements so you can do calculations + conditional logic to compute the value of such an element.
Comments.UserDisplayName: KarinG - Semper IT
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-08T19:32:57.457Z
Comments.Text: I'd be interested to see the improved fork -- is it on Github?
Comments.UserDisplayName: Laryn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-09T15:25:28.513Z
Comments.Text: Sorry - no notification on SE... Yes it’s in my GitHub KarinG - should be public. If you can’t find it ping me on Mattermost
Comments.UserDisplayName: KarinG - Semper IT
Tags: <civicontribute><webform-civicrm>
Title: Adding a dynamic “cover processing fees” checkbox to CiviCRM contribution form
ThreadText: # Adding a dynamic “cover processing fees” checkbox to CiviCRM contribution form
  
  (Asked by: username_0 on 2015-03-25)
  
  I've seen other systems that allow the donor to check a box to cover processing costs, similar to this:
  
  ![Cover processing fees](https://i.sstatic.net/5h2qI.jpg)
  
  In researching whether something like this was possible with CiviCRM, [this thread](http://forum.civicrm.org/index.php?topic=33098.0) is the closest I've found. The solution there is to simply put a flat rate additional amount.
  
  I'd love some guidance on how this could be implemented more dynamically (so the amount of the fee changes based on the size of the donation) as either a default contribution page, or a Webform-CiviCRM implementation. Anyone have an idea?
  
  **Tags:** civicontribute, webform-civicrm
  
  > **Comments:**
  > **username_1**: My organization would also be interested in such a feature. We use Joomla, so I'd be sad if it were implemented using drupal webforms.  
  > **username_2**: I do have sites where we do this with Webform CiviCRM module -> in D7WFC you’ll need Webform Calculator module (ask me for about a slightly improved fork if you’re thinking of this); in D8WFC -> Webform D8 has native computed Twig Elements so you can do calculations + conditional logic to compute the value of such an element.  
  > **username_0**: I'd be interested to see the improved fork -- is it on Github?  
  > **username_2**: Sorry - no notification on SE... Yes it’s in my GitHub KarinG - should be public. If you can’t find it ping me on Mattermost  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_6 on 2016-10-14. Score: 8 | Accepted answer
  
  It's pretty late to be answering this, but the *Percentage Price Field* extension supports something very much like this.
  
  > This extension allows you to add an "Additional Percentage" field to
  > any price set, which will automatically calculate and add an
  > additional amount to a transaction, as a configurable percentage of
  > other selected price set options.
  >
  > Want to ask donors to give an extra 3% to cover credit card processing
  > fees? Or to give an additional 10% of their membership fee to support
  > a special project? Then you're in the right place.
  >
  > Because it's a price set field, this option will appear as a line item
  > in contribution records and receipts, allow configuration of financial
  > type, label, help text, and other standard price field options, and
  > work equally well for contributions, memberships, events -- anywhere
  > you can use a price set.
  
  <https://civicrm.org/extensions/percentage-price-field>
  
  [Disclosure: I'm the author of this extension.]
  
  > **Comments:**
  > **username_7**: A nice feature would be if it could fully calculate the proper fee.  For example, with a typical processor, a fee might be $0.30 + 2.9%, the equation would be total=(subtotal+.3)/(1-.029).  
  > **username_6**: Thanks @username_7. I'm open to that; see https://github.com/twomice/com.joineryhq.percentagepricesetfield/issues/14  
  
  ---
  
  ### Answer by username_3 on 2015-03-25. Score: 6
  
  Price set options that change are doable, but in order to make the totaling work, you've got to rewrite that bit of code, because it adds and subtracts the single item amount you check or uncheck.
  
  Let's say the fee price option is pegged at 3%. You select $50, the fee option goes up to $1.50 and the total goes to $50. Now, you check the cover-my-fee box, bringing the total to $51.50. You decide to be more generous and select $100. The fee option goes up to $3, but it won't appear to take effect because the totaling only counts the change from $50 to $100. Your total will say $101.50. Now, you decide that if you're donating all that money, the least the organization can do is cover the fee. Uncheck the fee option, and the total goes to $98.50. It subtracts the option amount regardless of whether that's in the total.
  
  The solution to this is to rewrite that javascript to total the entire thing each time something changes.
  
  Hook\_civicrm\_buildAmount will take care of the amounts on the confirmation page since by that point, you'll know what options are selected.
  
  > **Comments:**
  > **username_0**: Thanks for this, Andrew! I'll put it in my "rainy day" list of things to experiment with. Do you know off-hand whether post-processing on a webform_civicrm form would work?  
  > **username_3**: Ooh--haven't tried that.  I bet it would work, but I don't know what you'd be changing on the webform vs. anything in CiviCRM.  
  > **username_1**: I'd like to try to implement this, but I'm not seeing how to "peg" a price option to a percentage. Is that an admin-accessible option, or is it only code-able?Also, would there be a way to implement CiviDiscount to handle this sort of thing? For instance, create a negative discount applicable only to Contributions, and instead of having the "apply discount" field at the top of the contribution page, have it as a check box right above the "Total Amount."  (I'm open to moving this to a new question, if that makes more sense. I'm not sure.)  
  > **username_3**: It would be in custom code. Price options out-of-the-box are only fixed prices.  
  
  ---
  
  ### Answer by username_4 on 2015-03-25. Score: 1
  
  The best way to achieve this would be to use price-sets and add the priceset item with the amount of the processing fees. When you have multiple donation amount options, it could be issue, but I think can be achieved via hook alter.
  
  > **Comments:**
  > **username_5**: Yes, but I believe the op is looking to calculate a percentage.  This will work if fixed.  Also, you must make it a required option.  
  
  ---
  
  ### Answer by username_0 on 2020-08-08. Score: 0
  
  Another extension to consider with a slightly different approach from *Percentage Price Field* is Fuzion's *Extra Fee* extension.
  
  * <https://github.com/fuzionnz/nz.co.fuzion.extrafee>
  
  > This extension allows for a credit card fee and optional processing fee for the CC payment to be added to the total to be paid via any payment processor that uses Credit Cards or other payment gateways. It does not get applied for Pay Later transactions.
  
  
  ---
  
  