Zen Cart Logo
Forums / Addon Payment Modules / Stripe.com payment integration module

Stripe.com payment integration module

Views: 233,183

Results 321 to 340 of 679
26 Apr 2024, 10:41 AM
#321
oj_simon avatar

oj_simon

Zen Follower

Join Date:
Nov 2023
Location:
Hounslow
Posts:
129
Plugin Contributions:
0

Stripe.com payment integration module

Hi,

I have just removed and reinstall stripe_modules_2.0.4 to confirm it is not me and i get the same results:
using 3-step checkout (have got OPC but have it set to: Enable One-Page Checkout false)

  1. after submitting the payment i get a:
    a. Whoops! Your session has expired. (https://phpstack-1180590-4294982.cloudwaysapps.com/index.php?main_page=time_out)

  2. the products I'm adding to the shopping cart are (
    2 x https://phpstack-1180590-4294982.cloudwaysapps.com/index.php?main_page=product_info&products_id=339
    priced at £35.00 each,
    with a cat SUB-TOTAL: £70.00

(this is correct)
then i go to checkout using 3-page checkout

Step 1 of 3 - Delivery Information £6.99 is added for shipping,ExpirationMM
Step 2 of 3 - Payment Information shows:
Your Total
£70.00 Sub-Total:
-£7.00 Group Discount:
-£40.00 Multibuy Discount:
£6.99 (Standard (3-5 Days) (£6.99) (2: 1 x £6.99 per 17)):
£29.99 Total:

(again this is correct)
Payment Method
Stripe Payments : Credit Card is auto selected due to it being the only payment method i offer.
confirm T&C
Step 3 of 3 - Order Confirmation:
Products
Qty. Product Name Total
2 x 2 for 30.00 first item£70.00
Sub-Total: £70.00

Group Discount:-£7.00

Multibuy Discount: -£40.00

(Standard (3-5 Days) (£6.99) (2: 1 x £6.99 per 17)):£6.99

Total:£29.99

29.99 will be charged to the payment method.

(at this point doing a echo $order->info['total'] shows £29.99 and this is correct.)

select stripe credit card -
enter card: 4242 4242 4242 4242 (test card)
enter Expiration: 11/26
enter CVC: 123
enter postcode: TW3 1YN
click pay.
get Whoops! Your session has expired.

then look in admin and no order is made.
look in stripe dashboard and see the payment as:
Payment details
Statement descriptor
ONLINE-JUNCTION.CO.UK
Amount
£76.99
Fee
£2.70

Net
£74.29
Status
Succeeded;

this is wrong as it has been padded the order total before discount?
)

test login details (will be deleted within 48 hours)

username: simonjohnrandall at gmail dot com
password: Pownall5968@
site url: https://phpstack-1180590-4294982.cloudwaysapps.com/index.php?main_page=login (site still in development)
product used above: should be in cart else it's 2 X https://phpstack-1180590-4294982.cloudwaysapps.com/index.php?main_page=product_info&products_id=339
shipping is set to selecting lowest price shipping option which should be the £6.99.

can someone please help me on this as this should not be the way this is working.

also thr return url is coded as: $confirmationURL = '"' . HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . 'index.php?main_page=checkout_confirmation"'; (line 62: includes\modules\payment\stripepay\create.php)

26 Apr 2024, 10:50 AM
#322
oj_simon avatar

oj_simon

Zen Follower

Join Date:
Nov 2023
Location:
Hounslow
Posts:
129
Plugin Contributions:
0

Re: Stripe.com payment integration module

this is wrong as it has been padded the order total before discount?
should read as:
this is wrong as it has been paid the order total before discount?

1 May 2024, 8:41 PM
#323
oj_simon avatar

oj_simon

Zen Follower

Join Date:
Nov 2023
Location:
Hounslow
Posts:
129
Plugin Contributions:
0

Re: Stripe.com payment integration module

carlwhat,

Can you please help on this??

2 May 2024, 1:39 AM
#324
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,954
Plugin Contributions:
8

Re: Stripe.com payment integration module

OJ_SIMON:

carlwhat,

Can you please help on this??

i am not really sure for what sort of help you are asking. you have a lot of things going on.

i do not have a working copy of this payment module, so i can not really provide help on it. i would think @Gozzandes who submitted the last version of it perhaps could help. or maybe @strelitzia would like to help, as he seems to have it working with OPC.

getting a page time out AFTER already charging a card and collecting the money is not good; and those page time outs can be tricky to debug. but i have no experience with this module. i only some times make comments on the code when it seems off.

best.

2 May 2024, 1:44 AM
#325
oj_simon avatar

oj_simon

Zen Follower

Join Date:
Nov 2023
Location:
Hounslow
Posts:
129
Plugin Contributions:
0

Re: Stripe.com payment integration module

carlwhat:

i am not really sure for what sort of help you are asking. you have a lot of things going on.

i do not have a working copy of this payment module, so i can not really provide help on it. i would think @Gozzandes who submitted the last version of it perhaps could help. or maybe @strelitzia would like to help, as he seems to have it working with OPC.

getting a page time out AFTER already charging a card and collecting the money is not good; and those page time outs can be tricky to debug. but i have no experience with this module. i only some times make comments on the code when it seems off.

best.

Thank you for that and sorry for mistaking you for the plugin maker.

23 May 2024, 9:35 PM
#326
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,566
Plugin Contributions:
58

Re: Stripe.com payment integration module

The installer has hardcoded table names and doesn't take into consideration the table prefix.

23 May 2024, 10:32 PM
#327
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,763
Plugin Contributions:
9

Re: Stripe.com payment integration module

Don't know if they mention it in the readme, etc., but using the Install SQL Patches in the admin will automatically look for a prefix and react accordingly.

https://docs.zen-cart.com/user/admin_pages/tools/install_sql_patches/

24 May 2024, 7:57 AM
#328
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,566
Plugin Contributions:
58

Re: Stripe.com payment integration module

dbltoe:

Don't know if they mention it in the readme, etc., but using the Install SQL Patches in the admin will automatically look for a prefix and react accordingly.

https://docs.zen-cart.com/user/admin_pages/tools/install_sql_patches/

This hard coding is in the install() function of the payment module in the 1.5.7 directory. I didn't check the 1.5.8 directory to see if it also has the issue.

24 May 2024, 8:43 AM
#329
oj_simon avatar

oj_simon

Zen Follower

Join Date:
Nov 2023
Location:
Hounslow
Posts:
129
Plugin Contributions:
0

Re: Stripe.com payment integration module

Hi Numinix,

I have found the current Stripe plugin to be sending the wrong amount to Stripe, it is sending the befor order total discount (that's the shopping cart subtotal)and before coupon discount total (the checkout total).

So I have been working on a new Stripe plugin which I'm trying to get to work like this:
client fills card details in on checkout payment page under payment method while the page submit main form is stopped from submitting then once received token response from stripe (checkout payment page url is set as return url) (no payment is taken on this page we send checkout total before coupon total) release the main form to be submittable again so they can enter coupon code and submit the main form. (which is the only time we get to know how much the coupon is worth if any). Then on the checkout confirmation page (again we still don't know the coupon cost until the page loads and it has to refreshes again) we show under the confirmation payment method, order details with the total order value (inc all coupon and discount) and a Pay $xx.xx Now button for the customer to pay without the page submitting as again we have to stop the main page from submitting.
(also let's not go into why on the confirmation page clients still get the chance to amend the hole order, when does Zen Cart give the payment method a fixed unchangeable total! yep on the success page a bit late on that payment should of been made by then actully by confirmation page/section).

and that is just to have a good flow looking checkout for the client on the 3 page checkout and for the one-page-checkout plugin it is much the same as the one thing they have overlooked is payment method plugin's have two parts to taking a payment one is the payment method select box and the second is the confirm payment method box (which is the box the data should be entered in to). so one-checkout should include the confirmation payment box from the confirmation page and have it listed under the select payment method box.

so whit that in mid,
I have got your Fast and Easy Checkout plugin I'm just in the middle of installing and updating for Zc v1.5.8 then make the checkout flow as it should be and integrate Stripe in to it as it should be then ask you if you can test it on your paid for Ajax Fast and Easy Checkout's then we we have a checkout working with and for Stripe and as to the other main and or one-checkout to work with my Stripe plugin the Zen Cart team and or one-checkout maker will have to amind there flow to be compatible.

So my question to you is would you like to help out on getting all this working and I will offer the Stripe-Plugin and you can offer the Fast and Easy Checkout (all 3 grades of it).

4 Jun 2024, 4:48 AM
#330
gozzandes avatar

gozzandes

Zen Follower

Join Date:
Jul 2021
Location:
Fukuoka Japan
Posts:
131
Plugin Contributions:
0

Re: Stripe.com payment integration module

Sorry for not updating recently.
I've been busy with work and haven't been able to do anything.

www\includes\modules\payment\stripe.php line 146

$amount_total=round($order->info['total']$order->info['currency_value'],$decimal_places)$multiplied_by;

I think it will be OK if you change it to the code below, but I haven't tested it.

if (MODULE_ORDER_TOTAL_INSTALLED) {
$order_totals = $order_total_modules->process();
$c = count($order_totals);
$c -= 1;
$order_value = $order_totals[$c]['value'];
} else{
$order_value = $order->info['total'];
}

$amount_total=round($order_value * $order->info['currency_value'],$decimal_places)*$multiplied_by;

:wacko:

4 Jun 2024, 8:08 AM
#331
gozzandes avatar

gozzandes

Zen Follower

Join Date:
Jul 2021
Location:
Fukuoka Japan
Posts:
131
Plugin Contributions:
0

Re: Stripe.com payment integration module

www\includes\modules\payment\stripe.php line 119
change the code from
global $order, $db,$stripeCustomerID,$user_id,$stripe_select;
to
global $order, $db,$stripeCustomerID,$user_id,$stripe_select,$order_total_modules;

www\includes\templates\YOUR_TEMPLATE\templates\tpl_checkout_confirmation_default.php
You have to find following code and delete it.

<?php if (MODULE_ORDER_TOTAL_INSTALLED) { $order_totals = $order_total_modules->process(); ?>
8 Jun 2024, 2:04 PM
#332
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: Stripe.com payment integration module

Hi,
Thank you for offering the updated stripe payments module. We would like to add apple pay to our site and stripe seems like the best option. We have installed the mod on a test site and noticed a couple of issues during testing.

  1. When using one page checkout (OPC) the stripe form is not appearing. This has been mentioned by other users and I believe strelitzia may have found a possible fix. I have tried adding the javascript files to OPC pages but it still did not work.

  2. We noticed the path through payment process doesn’t seem to follow the usual checkout procedure. Payment modules often have a process similar to the following: customer clicks confirm at checkout_confirmation page – then on a new page card details are entered – customer is then sent to checkout_process page – if payment is successful customer will be redirected automatically to checkout_success page.

We are unsure why the $confirmationURL in create.php has been set to the checkout_confirmation page. I believe this should ideally be the checkout_process or checkout_success page.

As mentioned in post 307 the stripe dashboard shows an incomplete payment for every successful one. This could be because the customer is redirected from checkout_confirmation to checkout_confirmation when completing a stripe payment.

There is an informative post from DrByte on another thread in 2015 which explains the usual path through payment process.

If the checkout procedure for the mod could be amended it may remove the need to hide the confirm order button as mentioned in post 310.

Several core file edits/overrides are made, particularly to the checkout_confirmation page. If card details were entered on a separate (new) page the mod may not need core file edits - making it easier to install and could help avoid integration issues.

I’m sure apple pay and google pay would be a popular feature with customers – particularly if they could be used with the guest checkout feature of OPC.

If anyone can offer advice or help to resolve either of these issues it would be much appreciated.
Many thanks
Richard

11 Jun 2024, 7:18 AM
#333
gozzandes avatar

gozzandes

Zen Follower

Join Date:
Jul 2021
Location:
Fukuoka Japan
Posts:
131
Plugin Contributions:
0

Re: Stripe.com payment integration module

When using one page checkout (OPC) the stripe form is not appearing. This has been mentioned by other users and I believe strelitzia may have found a possible fix. I have tried adding the javascript files to OPC pages but it still did not work.

I haven't tried OPC, so I haven't confirmed it, but maybe
You need to place the following script code in the header of the page that displays the Stripe form.
This is \includes\modules\pages\checkout_confirmation\jscript_stripe.php.
If you place the codes in OPC's header, I think the stripe form will be displayed.

<?php if(MODULE_PAYMENT_STRIPE_STATUS === 'True' && $stripe_select == 'True' ) {?>
<link rel="stylesheet" href="checkout_confirmation.css" />
 <script src="https://js.stripe.com/v3/"></script>
<script src="includes/checkout.js" defer></script>
<?php } ?>

We noticed the path through payment process doesn’t seem to follow the usual checkout procedure. Payment modules often have a process similar to the following: customer clicks confirm at checkout_confirmation page – then on a new page card details are entered – customer is then sent to checkout_process page – if payment is successful customer will be redirected automatically to checkout_success page.

I have the same opinion.
The reason why I chose this unnatural process is because
The form provided by Stripe and payment button must be the same page.
Additionally, by using the Stripe form, the credit information are directly sent to the Stripe server, resolving the risk of using the $_GET or $_POST function during payment.

We are unsure why the $confirmationURL in create.php has been set to the checkout_confirmation page. I believe this should ideally be the checkout_process or checkout_success page.

The following variables in create.php are used in \includes\checkout.js.
Clients 
PublishableKey
confirmationURL
PaymentSuccess
Also, checkout.js is used for the checkout_confirmation page.

As mentioned in post 307 the stripe dashboard shows an incomplete payment for every successful one. This could be because the customer is redirected from checkout_confirmation to checkout_confirmation when completing a stripe payment.

exactly.
After pressing the order confirm button, \includes\modules\payment\stripe.php and create.php are reprocessed.
as the result incomplete payment is added.

12 Jun 2024, 9:19 AM
#334
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: Stripe.com payment integration module

Hi Gozzandes
Many thanks for your reply. I have uploaded the suggested code (jscript_stripe.php) to includes/modules/pages/checkout_one but unfortunately it still did not appear.

When checking the browser web developer console the javascript did not load.

For testing purposes I removed the following code:
if(MODULE_PAYMENT_STRIPE_STATUS === 'True' && $stripe_select == 'True' )

The javascript now loads in the web developer console but the stripe form does not display.

An error is now displayed in the console: ReferenceError: Can't find variable: PublishableKey

This suggests that the includes/modules/payments/stripe.php file may not be loading correctly when using OPC.

It would be much appreciated if anyone could help advise why OPC seems unable to load the files required by the stripe module. Perhaps lat9 or strelitzia may be able to help.

Many thanks
Richard

12 Jun 2024, 11:34 AM
#335
gozzandes avatar

gozzandes

Zen Follower

Join Date:
Jul 2021
Location:
Fukuoka Japan
Posts:
131
Plugin Contributions:
0

Re: Stripe.com payment integration module

I'll explan flow of the credit Card Information.

  1. Check out payment page(Step 2 of 3 -Payment Information)
    Select "Stripe Payments : Crédit Card" and click "Continue" button.
    and call Payment module.

  2. Payment module
    \includes\modules\payment\Stripe.php
    line 121 to 129 =>Call Stripe publishable key and secret key.
    line 131 to 146 =>Calculate currency Information.
    line 146 to 154 =>Enter customer and order information into variables.
    line 156 call create.php
    \includes\modules\payment\stripepay\create.php
    line 8 to 46=>Create Stripe paymentintent.
    line 49 to 58=>Extract Stripe Client secret.
    Variable Client secret
    PHP : $clientS_json
    Script : ClientS

  3. checkout_confirmation page(Step 3 of 3 - Order Confirmation)
    Following files are opened.
    \includes\templates\YOUR_TEMPLATE\templates\tpl_checkout_confirmation_default.php
    \includes\modules\pages\checkout_confirmation\jscript_stripe.php
    \includes\checkout.js
    and Stripe form displayed.

    \includes\templates\YOUR_TEMPLATE\templates\tpl_checkout_confirmation_default.php
    line 167 to 177 Stripe form
    line 196 to 206 If Stripe ClientS exist, original zen cart confirm button will not be displayed and Stripe button will be displayed.

  4. Push Stripe confirm button.
    Payment succeeded : Goto \includes\checkout.js line 75. and original zen cart confirm button will be clicked.

If you want to Display Stripe form, Stripe form Needs Client secret (ClientS) before opeing.
Client secret requests order total,currency,customer Name and payment methods.

Based on the flow above, when using OPC, Client secret should be generated after clicking the checkout button.

You need to create a file in \includes\modules\pages\checkout_payment\ folder that contains the code to display the stripe form.

14 Jun 2024, 12:31 AM
#336
gozzandes avatar

gozzandes

Zen Follower

Join Date:
Jul 2021
Location:
Fukuoka Japan
Posts:
131
Plugin Contributions:
0

Re: Stripe.com payment integration module

I may build a module for OPC, but I am currently in the busy farming season, I won't be able to do anything until September.
:no:

14 Jun 2024, 3:54 PM
#337
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: Stripe.com payment integration module

Hi Gozzandes
Thank you for explaining the flow of credit card information and for your suggestion on how to fix the issue. Unfortunately I have been unable to get OPC and stripe to work together. It appears that a separate page or mod may be required. If you are able to either update the stripe mod or create a new mod in future it would be much appreciated.
Many thanks
Richard

19 Jun 2024, 1:44 PM
#338
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
942
Plugin Contributions:
3

Re: Stripe.com payment integration module

Before I make this update push, I was receiving error messages on the customer side (ZC 2.0.1 / PHP 8.3 / Mod version 2.05) stating that the table "myprefix_stripe" was not available. I ended up finding a table just named "stripe" in my database listing. I renamed that database as necessary and everything worked nominally.

Then noticed the following code:

in \www\includes\modules\payment\stripe.php (both directories)

  $db-> execute("CREATE TABLE stripe(id INT(11) AUTO_INCREMENT PRIMARY KEY,customers_id INT(11),Stripe_Customers_id VARCHAR(32))");

Should this code be changed to:

  $db-> execute("CREATE TABLE " . DB_PREFIX  . "stripe(id INT(11) AUTO_INCREMENT PRIMARY KEY,customers_id INT(11),Stripe_Customers_id VARCHAR(32))");
19 Jun 2024, 1:52 PM
#339
oj_simon avatar

oj_simon

Zen Follower

Join Date:
Nov 2023
Location:
Hounslow
Posts:
129
Plugin Contributions:
0

Re: Stripe.com payment integration module

retched:

Before I make this update push, I was receiving error messages on the customer side (ZC 2.0.1 / PHP 8.3 / Mod version 2.05) stating that the table "myprefix_stripe" was not available. I ended up finding a table just named "stripe" in my database listing. I renamed that database as necessary and everything worked nominally.

Then noticed the following code:

in \www\includes\modules\payment\stripe.php (both directories)

$db-> execute("CREATE TABLE stripe(id INT(11) AUTO_INCREMENT PRIMARY KEY,customers_id INT(11),Stripe_Customers_id VARCHAR(32))");

> 
> Should this code be changed to:
> 
> ```php
  $db-> execute("CREATE TABLE " . DB_PREFIX  . "stripe(id INT(11) AUTO_INCREMENT PRIMARY KEY,customers_id INT(11),Stripe_Customers_id VARCHAR(32))");

Yes - if this is just for your own use,
No - if it is for use by others also.

19 Jun 2024, 2:03 PM
#340
oj_simon avatar

oj_simon

Zen Follower

Join Date:
Nov 2023
Location:
Hounslow
Posts:
129
Plugin Contributions:
0

Re: Stripe.com payment integration module

define('TABLE_STRIPE', DB_PREFIX . 'stripe');
$db-> execute("CREATE TABLE " . TABLE_STRIPE  . "(id INT(11) AUTO_INCREMENT PRIMARY KEY,customers_id INT(11),Stripe_Customers_id VARCHAR(32))");

the above is how it should be done then anyone can use it without having to change code.