Hackasacka
Hackasacka
Offline
Hi Support,


We have installed the "Stripe" payment gateway via the "Marketplace" into Arastta ver 1.6.1 successfully.

We have added the "Stripe" public and secret test keys to the payment module via admin and put Stripe into "test" mode. The "Stripe" api keys have been tested elsewhere to ensure they are valid and that they are working.

When testing to see if we can make a payment as a guest using "Credit or Debit Card (Processed securely by Stripe)", on the checkout page (/index.php/checkout) the "Confirm Order" section is totally blank and there is no "Confirm Order" button.

Please can you offer any advise to help us get this to work properly?


Kind regards,


Hackasacka
Tuesday, August 29 2017, 07:34 PM
Share this post:
Responses (6)
  • Accepted Answer

    Friday, September 01 2017, 06:37 AM - #Permalink
    Also noticed the module only offers 2 currencies yet their website says they deal in 130 currencies.
    Needs a little adapting I guess for other currencies. Will try it out hopefully this weekend and see what kind of outcome I have.
    The reply is currently minimized Show
  • Accepted Answer

    Hackasacka
    Hackasacka
    Offline
    Friday, September 01 2017, 11:58 AM - #Permalink
    Hi Breck,

    We need to get the module to work first? One step at a time, but thank you for your input.

    If you turn on debugging in the Admin - System - Setting - Server (tab). Debug System - Yes : Display Errors Yes

    Then go to the page the checkout page (/index.php/checkout) the error message gives a file not found error for "/catalog/view/theme/payment/stripe.tpl".

    If you then find the file "stripe.tpl" (placed after the successful install?) in dir "/catalog/view/theme/default/template/payment/stripe.tpl" and copy it to the first location ("/catalog/view/theme/payment/stripe.tpl") then the "Stripe" payment gateway module works in a fashion.

    This is only a work around for now.

    However, there are two "Confirm" payment buttons and the CSS for the credit card expiry date needs changing so you can see the input i.e. style = "width: 4em"

    The implication is that this module was not tested before being released as a Core feature in (1.6.0). We also tested and found to have the same error.

    The "Stripe" payment module only appears to have a file location issue during the installation.

    Hope this helps,

    Regards,

    Hackasacka
    The reply is currently minimized Show
  • Accepted Answer

    Hackasacka
    Hackasacka
    Offline
    Wednesday, September 06 2017, 10:03 PM - #Permalink
    Hi Support,

    We have also noticed an error for particular orders when the calculations of products including any taxes and shipping which create the total order value used by Stripe "$order_info['total']" are not an integer when multiplied by 100 to give the decimal pennies required for transfer to Stripe.

    Here is an example:-

    "PHP Fatal error: Uncaught exception 'Stripe\Error\InvalidRequest' with message 'Invalid integer: 1658.8' in /public_html/system/library/stripe-php/ApiRequestor.php:108 from API request 'req_v9Uipdc8Gz9kKd'

    Here is an example of a product price that will give a 500 Internal Server Error:-

    Product Price $8.59 (this is calculated by (5.49 * 1.2) + 2 - actually 6.588 + 2 = 8.588)
    Sub-Total: $5.49 (price entered for product)
    Flat Shipping Rate: $5.00 (value given to shipping)
    Eco Tax (-2.00): $4.00 (calculated by 2 + 2 for product and shipping in this example)
    VAT (20%): $2.10 (calculated by (5.49 * 0.2) + (5.0 * 0.2) vat on product and shipping)
    Total: $16.59 (actually 16.588 rounded to 16.59)

    This is with Arastta ver 1.6.1 default currency, shipping and taxes, so a default install and any product given a price of $5.59 should error if the tax for VAT is 20% (or any prices that when multiplied by the tax has more than 2 decimal places of accuracy).

    There is a possibility that errors due to decimal fractions being converted to binary leave remainders too. It depends on weather they convert exactly or not i.e. 0.5 base ten is 0.1 base 2 (computers have to work in base 2 only and convert back to the nearest decimal place if not an exact integer and may or often have small rounding errors). 0.75 is 0.11 (0.5 + 0.25).

    Found my Texas Instruments calculater gets it wrong too for example 644245094.4 x 2 = 1288508189 (obviously it is 1288490188.8 or at least you can see that the fractional part 0.4 x 2 = 0.8 so the calculater has to be wrong?)

    Just like 1/3 is 0.333333...

    As the location of the stripe.php making this calculation is here:-
    /public_html/catalog/controller/payment/stripe.php

    Modify line 71 from:-

    'amount'   => $order_info['total'] * 100,


    to

    'amount'   => (int) $order_info['total'] * 100,


    to fix this issue and correctly round up the value in this case.

    Hope this helps,

    Regards,

    Hackasacka
    Like
    1
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 07 2017, 12:13 PM - #Permalink
    I added it to GH Issues for you: https://github.com/arastta/addons/issues/43
    The reply is currently minimized Show
  • Accepted Answer

    Hackasacka
    Hackasacka
    Offline
    Thursday, September 07 2017, 02:15 PM - #Permalink
    Hi Rune,

    Ok that should help any future versions.

    1. We noticed that the paths were incorrect during the installation.
    2. The rounding error last posted and resolved
    3. It looks a little better if the
    <div class="col-md-6">

    instead of
    <div class="col-md-4">

    on line 2 of the stripe.tpl
    (currently here /public_html/catalog/view/theme/payment/stripe.tpl)

    Regards,

    Hackasacka
    The reply is currently minimized Show
  • Accepted Answer

    Hackasacka
    Hackasacka
    Offline
    Monday, September 11 2017, 07:54 PM - #Permalink
    Hi Rune,

    If we correct the path calling the "stripe.tpl" it is then not necessary to move the "stripe.tpl" to a different folder in order to see the checkout page for the Stripe payment gateway.

    Path "catalog/controller/payment/stripe.php" line 50

            return $this->load->view('default/template/payment/stripe.tpl', $data);



    and in the same file but line 72 for the rounding
    'amount'   => (int) $order_info['total'] * 100,


    And if you would like better styling line 2
    Path "catalog/view/theme/default/template/payment/stripe.tpl"
    <div class="col-md-6">


    This fixes the Stripe installlation.

    Regards,

    Hackasacka
    The reply is currently minimized Show
Your Reply