Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting plan exact amount to charge #214

Open
michelterstege81 opened this issue Nov 14, 2023 · 5 comments
Open

Setting plan exact amount to charge #214

michelterstege81 opened this issue Nov 14, 2023 · 5 comments

Comments

@michelterstege81
Copy link

The cashier_plans.php config says the following:

'amount' => [

                /**
                 * A string containing the exact amount you want to charge each billing cycle, in the given currency.
                 * Make sure to set the right amount of decimals. Non-string values are not accepted by Mollie.
                 */
                'value' => '10.00',

                /**
                 * An ISO 4217 currency code. The currencies supported depend on the payment methods that are enabled on
                 * your Mollie account.
                 */
                'currency' => 'EUR',
            ],

This would imply that exactly 10 Euro's will be charged. However this is the price excluding VAT. If my billable model returns a tax percentage this amount is added.

I currently have a customer who want to charge exactly €35,- including 21% taxes. When I set 28.92 or 28.93 both cases will not result in 35.00.

How can I solve this? What is the right amount of decimals. Is this 2 for Mollie? Or can I add the amount of decimals that is right for my price?

@Naoray
Copy link
Collaborator

Naoray commented Nov 15, 2023

Hello @michelterstege81,

I share your concern regarding the potentially misleading description of the cashier_plans amount. It would be more accurate to specify that taxes will be calculated in addition to the provided value if the taxPercentage() method is applied to the Billable model.

I ll discuss this internally, but one option is to introduce a configuration value such as value_includes_taxes to allow the inclusion of taxes in the plan's value.


The current issue revolves around the tax calculation process. The objective is to achieve a total of 35.00. However, a challenge arises due to the rounding errors in the tax calculation, which is determined by the formula subtotal * taxPercentage / 100.

For example, using a subtotal of 28.92 €:

  • Calculation: 28.92 * 21 / 100 = 6.0732
  • Rounded down tax value: 6.07 €
  • Resulting total price: 34.99 €

Alternatively, with a subtotal of 28.93 €:

  • Calculation: 28.93 * 21 / 100 = 6.0753
  • Rounded up tax value: 6.08 €
  • Resulting total price: 35.01 €

Adjusting the RoundingMode to ROUND_DOWN could address this. However, implementing this change involves modifying two code points:

  1. In the StartSubscription class, set BaseAction@getTotal()'s protected $roundingMode parameter to Money::ROUND_DOWN.
  2. In the OrderItem@getTaxAttribute() method, override the function and use Money::ROUND_DOWN for the multiply function.

Please note that the lack of container binding for StartSubscription makes the override more complex.

I will further explore this internally, ensuring I haven't overlooked any details, and provide an update shortly.

@michelterstege81
Copy link
Author

Thanks for your reply. I think it would be very nice to have a configuration option that states if the price includes/excludes taxes. I know that WordPress WooCommerce solves the issue this way.

If for now a workaround is available I would very much like to hear about it :)

Thanks for looking into this!

@Naoray
Copy link
Collaborator

Naoray commented Nov 20, 2023

Hi @michelterstege81,

right now there is no workaround for this. Let me talk to the team and see if we can come up with something that at least would allow you to configure the rounding mode that is used to calculate the tax.

I ll keep you posted

@michelterstege81
Copy link
Author

Thanks for the feedback.

We are looking forward to a solution where we can charge the €35,- including 21% taxes.

@clebuchegger
Copy link

+1 also very curious about this feature :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants