• Resolved threadi

    (@threadi)


    Hello,

    In one of my projects, a Stripe order was triggered via your plugin. Unfortunately, the wrong amount was transferred.

    The following background:
    The store sells to Austria and Germany. The customer in question has entered a German billing address. He was also shown the correct amount of 6190 EUR for the case (total with German VAT + 250 EUR shipping). However, Stripe billed the wrong amount: 5990 EUR, which would be the total for Austria with 0-EUR shipping.

    The log file of your plugin says:

    [id] => redacted
    [amount] => 5990
    [amount_refunded] => 0
    [currency] => EUR
    [order_amount] => 6190
    [order_currency] => EUR
    [captured] => Captured
    [transaction_id] => redacted
    [mode] => Live

    Why is the wrong amount being read out for amount? Where does it come from?

    Used:
    WordPress 6.4.4
    WooCommerce 8.7.0
    Stripe Payment Plugin for WooCommerce 3.9.8

    Many thanks for your help in advance ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @threadi,

    Greetings from Webtoffee!

    I understand that you are experiencing trouble with the final amount of the purchase. Kindly note that our plugin uses the function given below to fetch the amount and currency from Woocommerce and then passes it on to Stripe. We are just taking the values provided by Woocommerce to complete the order.

    $order->get_total()
    $order->get_currency();

    If you are using any other plugin related to currency conversion or taxation, sometimes the issue may arise from them. We suggest checking that they pass the values correctly to these functions.

    Thread Starter threadi

    (@threadi)

    Thanks for the tip. I have now been able to trace the path of the price. The reason is the individual theme of the project, which has not updated the shopping cart value in the HTML code that your plugin uses for the price transfer. I have been able to solve this and it now works.

    However, I am still wondering about the indication of the price in the HTML code. I noticed the following:

    In the eh_stripe_checkout.js file, an input field is added before the checkout is sent:

    $form.append( '<input type="hidden" class="eh_stripe_pay_amount" name="eh_stripe_pay_amount" value="' + $data.data( 'amount' ) + '"/>' );

    The value of this field again comes from the HTML element with the ID eh-stripe-pay-data. This is generated via the file class-stripe-api.php when the checkout is called up.

    The value of the input field is then read as $amount in the file class-stripe-api.php line 693:

    $amount = isset( $_POST['eh_stripe_pay_amount'] )? sanitize_text_field($_POST['eh_stripe_pay_amount']) : self::get_stripe_amount(((WC()->version < '2.7.0') ? $wc_order->order_total : $wc_order->get_total())) ;

    This value is then passed to the Stripe API as ‘amount’.

    Thus, a customer could enter any amount by manually changing the data-amount field after calling the checkout. Of course, this does not match the WooCommerce order, but is waved through to Stripe without further checking.

    It might be good if you took a closer look at this. Otherwise, the plugin is super reliable, thanks for that ??

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @threadi ,

    Thank you for your valuable recommendation. We will strive to incorporate this improvement in our next release and have added it to our backlogs.
    Once again, we appreciate your interest in our plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Incorrect amount charged’ is closed to new replies.