How to add a new Billing srategy besides the existing one?

183241677's Avatar


25 May, 2016 03:14 AM

Hello, Guys

How to add a new billing strategy?

What are the detailed steps?

for example:
1) write a new class NewBillingTaskBase extends PluggableTask implements NewBillingTask {}
But the question is
1) where's the existing BillingTask?
2) how to make relationship between NewBillingTask interface & view page?

  1. 1 Posted by Vikas@WebDataTe... on 26 May, 2016 10:30 AM

    Vikas@WebDataTechnologiesLLP's Avatar


    Can you describe your user scenario case study?

    It is not clear what exactly you'd like to achieve.

    Vikas@Web Data Technologies

  2. 2 Posted by 183241677 on 26 May, 2016 01:10 PM

    183241677's Avatar


    I'd like to build up a new process for calculating price for each customer in each customized period

    Calculating rules depend on amount of customer usage. For example, when usage amount is less than 100kg the calculating rule differs from calculating rules when usage amount is more than 101kg

    And a input data file contains input data. The input data are in structured format, for example

    customer123 order1 10 customTypeA
    customer456 order2 20 customTypeC

    So, which parts should I add for forming up the whole process?

    How can add a new tab besides the existing ones, which are Customer, Configuration .etc.


  3. Support Staff 3 Posted by Technical Suppo... on 31 May, 2016 12:14 PM

    Technical Support's Avatar


    For adding the new tab, I think you need to modify _header.gsp. For pricing changes that you need to make, please check if you can add custom code in a new implementation of InvoiceCompositionTask. This task is called right at the time of invoice generation. So if you need to charge customer specific prices based on quantity, that rule can go into your custom logic when order lines are charged onto invoice as invoice lines. So every invoice line will have new calculation as per the quantity being charged from the order line. This is one option. With this option though you would not be able to see the price charged at the order level. It will reflect directly on the invoice. If you need to see pricing rule applied at order level, as reflect changed price as per the quantity, please let us know and we will suggest another way.

    jBilling Technical Support Team.

  4. 4 Posted by Vikas@WebDataTe... on 01 Jun, 2016 05:10 AM

    Vikas@WebDataTechnologiesLLP's Avatar


    Adding a new tab is not so straight-forward, you need a bunch of files to
    change and you may also have to code a controller to handle actions for the
    new tab.

    As far as Pricing solution goes, you need an implementation of IPricing
    interface as a Plugin to make it configurable. This implementation should
    have all the rules according to your requirement.

    If you are on jBilling version 3.x, you can implement drools pricing rules
    and I would recommend that approach because its more modular.

    vbodani @ Skype

  5. 5 Posted by 183241677 on 02 Jun, 2016 07:29 AM

    183241677's Avatar

    Hello Technical Support Team

    Yes, we need to see pricing rule applied at order level, as reflect changed price as per the quantity, so what is the another way is ? :)

    Also we need adding rules in invoice generation process, and found there are 4 existing classes implementing InvoiceCompositionTask under

    (1) com.sapienter.jbilling.server.pluggableTask:

    (2) com.sapienter.jbilling.server.process.task:
        abstract class AbstrackChargeTask extends PluggableTask implements InvoiceCompositionTask {}
        class SureTaxCompositionTask extends PluggableTask implements
    InvoiceCompositionTask {}

    (3) com.sapienter.jbilling.server.process: import InvoiceCompositionTask

    So which class of the above reprents for existing a invoice's total fee calculating rule class?
    Or should we configure classes rules mapping relationships in db? If yes in which table can we configure for control the process?

    I read the above classes' implementation codes of InvoiceCompositionTask's declared method
    public void apply (NewInvoiceContext invoice, Integer userId) throws TaskException;
     But didn't find java code for calculating total price, so which part of java codes calculates the total price of invoice when invoice is being generated?

  6. 6 Posted by 183241677 on 02 Jun, 2016 07:38 AM

    183241677's Avatar

    Hello Vikas

    Thank you. What is exact position of IPricing interface? Or should I add a new interface naming IPricing and then add implementation java class? What's the table name in database to be inserted a new record for enabling new added IPricing & implementation java class to work?

    I'm on jbilling 4.1.1-src and how to implement drools pricing rules in detail? For example which java code files should be modified?



  7. 7 Posted by 183241677 on 23 Jun, 2016 08:29 AM

    183241677's Avatar

    Hello Technology Support Team,

    After I added a new class A implemented InvoiceCompositionTask, how can I enable A to take effect and take place of the existing one in order the running logic not still run into the existing logic one?

    Which one is the existing one which is taking effect which are calculating amount in the way price.multiply(quantity)?


  8. Support Staff 8 Posted by Technical Suppo... on 24 Jun, 2016 10:48 AM

    Technical Support's Avatar

    Hello ,

    For this you ineed to extends class A from PluggableTask.
    (like Class A extends PluggableTask implements InvoiceCompositionTask) . And configure class A as new pluggin. Also you need to add your class A in pluggable_task_type table .

    Thank you
    jBilling Technical Support Team

  9. 9 Posted by 183241677 on 24 Jun, 2016 04:47 PM

    183241677's Avatar

    Hello Support Team,

    How to configure class A as new plugin ? And how to disable the existing one in order to avoid program still run into the existing old plugin after enabled the class A as the new one ?

    Thank you,

    ------------------ 原始邮件 ------------------
    发件人: "Technical Support";<[email blocked]>;
    发送时间: 2016年6月24日(星期五) 晚上6:48
    收件人: "Jeffery"<[email blocked]>;

    主题: Re: How to add a new Billing srategy besides the existing one? [Questions #964]

  10. 10 Posted by Libby Evans on 16 Mar, 2024 12:20 PM

    Libby Evans's Avatar

    Hi there,

    We run an Instagram growth service, which increases your number of followers both safely and practically.

    • Guaranteed: We guarantee to gain you 300-1000+ followers per month.
    • Real, human followers: People follow you because they are interested in your business or niche.
    • Safe: All actions are made manually. We do not use any bots.

    The price is just $60 (USD) per month, and we can start immediately.

    If you are interested, and have any questions, reply back and we can discuss further.

    Kind Regards,

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac