Re: Stripe.com payment integration module
1.
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;
2.
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();
?>
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
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.
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
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.ph p
\includes\modules\pages\checkout_confirmation\jscript_stripe.php
\includes\checkout.js
and Stripe form displayed.
\includes\templates\YOUR_TEMPLATE\templates\tpl_checkout_confirmation_default.ph p
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.
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:
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
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)
PHP Code:
$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 Code:
$db-> execute("CREATE TABLE " . DB_PREFIX . "stripe(id INT(11) AUTO_INCREMENT PRIMARY KEY,customers_id INT(11),Stripe_Customers_id VARCHAR(32))");
Re: Stripe.com payment integration module
Quote:
Originally Posted by
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)
PHP Code:
$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 Code:
$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.
Re: Stripe.com payment integration module
Code:
define('TABLE_STRIPE', DB_PREFIX . 'stripe');
PHP Code:
$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.