Jump to content
asro2004

Stripe v3 module for SCA

Recommended Posts

@asro2004

Module works perfectly, thank you for your endeavours again.

I notice that the Stripe website talks about Apple Pay, Google Pay and Samsung Pay. Are these options available in the existing addon? If not is this possible? Stripe talk about APIs for these but it is all above my pay grade.


Live Phoenix 1.0.5.0 on PHP 7.3

Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix 1.0.5.0) here.

Share this post


Link to post
Share on other sites

I've updated the module to version 1.0.13 to remove a potential SQL injection and tidy the account saved cards display when there are multiple cards (thanks @Smoky Barnable).

@mhsuffolk I'm afraid the current version does not support Apple Pay, etc but looking at the Stripe documentation, it does not look too difficult to add. It just involves adding an extra HTML element to host a 'Payment Request' button which is displayed for certain compatible browsers, and some javascript and server code to support the creation and processing of a 'PaymentRequest' in a similar fashion to the handling of the 'PaymentIntent' in the current version. I'll add it to my list of things to do.

Share this post


Link to post
Share on other sites

I recently installed the latest update and since then have noticed that on the store invoice the Total and figure are above the Shipping costs and the Sub total. Is it just me or should they be the other way around with the sub total, then the shipping then the total.  Looking back through previous orders with the Stripe payment module the order was correct. All other payment modules show correctly on my altered invoice layout.

Image to show difference below.

invoice-totals-latest.jpg

invoice-totals-old.jpg

Edited by 14steve14

REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Mine is OK on v1.0.13 but I had a similar issue several versions back but only in admin, not in the conformation emails. It corrected itself and has not reappeared.


Live Phoenix 1.0.5.0 on PHP 7.3

Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix 1.0.5.0) here.

Share this post


Link to post
Share on other sites

I'm confused.  I've installed stripe_sca on my Phoenix 1.0.4.0 store and everything appears to work OK.  However, I noted this in an earlier post:

Quote

implemented authorise only transactions. Authorised transactions have to be captured using the Stripe dashboard, which will then fire the call to the webhook and complete the order

So, I could not tell anything in Phoenix Admin after successfully processing a shopping cart.  I kept trying to update the order status to something that would call the webhook, to no avail.  So, after seeing the post with the quote above, I went to Stripe's dashboard and saw that there was a button to "Capture" the credit card payment.  That registered a successful call to the webhook and it looks like I finally got the money (in test mode).

I rarely, if ever, visited the Stripe site in managing my existing 2.3.4 store.  Is there nothing that will call the webhook from Phoenix?  Do we have to visit Stripe to capture the payment every time we get a credit card purchase?

Probably I'm missing something, as usual ...

Share this post


Link to post
Share on other sites
4 minutes ago, mhsuffolk said:

In the Stripe module in your website's admin change authorise to capture. 

Excellent!  My next test order was Prepared, Transacted, and Received all in one fell swoop!

I figured I was missing something.  Thanks!

Share this post


Link to post
Share on other sites
On 12/4/2019 at 11:08 PM, 14steve14 said:

I recently installed the latest update and since then have noticed that on the store invoice the Total and figure are above the Shipping costs and the Sub total. Is it just me or should they be the other way around with the sub total, then the shipping then the total.  Looking back through previous orders with the Stripe payment module the order was correct. All other payment modules show correctly on my altered invoice layout.

Image to show difference below.

invoice-totals-latest.jpg

invoice-totals-old.jpg

Please check the sort order of the totals in Modules ~ Order Totals. If all the totals have the same sort order number, that could cause the totals to be in different sequence under different circumstances, depending on what previous queries mysql had run and how it had managed it's cache.

The order totals are saved to the database in includes/modules/payment/stripe_sca.php lines 207-214, with the configured sort order, and the order email totals are output in lines 491-493 of that module. The $order_totals variable is set in checkout_process.php using the output of order_total->process(). That prepares the totals in the sequence in which the totals appear in the database configuration table, record with the configuration_key: MODULE_ORDER_TOTAL_INSTALLED. So the email prepared by the stripe_sca module should have the sub totals in the sequence in the configuration table record, but if the order is reprinted from the administration order screen, the totals could be out of sequence if the sort order had not been set.

The customer email should be ok, and the problem only occur when the order is re-printed.

 

Share this post


Link to post
Share on other sites

I've had a few customers report payment problems when using the Brave browser. Not sure how popular that browser is, but thought I would mention it. Customers say after they enter their credit card number, the input box turns gray and the number disappears. Nothing happens upon submission. Checking Stripes logs it states payment method not selected.


The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence.

- Rabindranath Tagore

Share this post


Link to post
Share on other sites

My understanding is that the actual field that the customer inputs his card details is hosted by Stripe, the surrounding box is on your server. Perhaps a question to Stripe here might yield an answer.


Live Phoenix 1.0.5.0 on PHP 7.3

Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix 1.0.5.0) here.

Share this post


Link to post
Share on other sites

Turns out they don't support the Brave browser. Only the browsers listed here will function properly.

https://stripe.com/docs/js/appendix/supported_browsers

It would be nice to display a message to customers that aren't using a supported browser.


The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence.

- Rabindranath Tagore

Share this post


Link to post
Share on other sites

Uploaded Update

Version 1.0.14

- Added line to reset attributes variable between each product in order e-mail

Attributes were concatenated through all products in order confirmation mail.

This update changes this file:
includes/modules/payment/stripe_sca.php
but the entire contents of the ext and includes folders in the update can be copied to the catalog root of the store.

Edited by raiwa

Share this post


Link to post
Share on other sites
48 minutes ago, raiwa said:

but the entire contents of the ext and includes folders in the update can be copied to the catalog root of the store.

I think that a better solution to this would be to fix the DIR_FS_CATALOG value in includes/configure.php to not change with the location of the calling page.  Then you can leave the files inside ext.  Note that the install procedure already does this. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
26 minutes ago, ecartz said:

I think that a better solution to this would be to fix the DIR_FS_CATALOG value in includes/configure.php to not change with the location of the calling page.  Then you can leave the files inside ext.  Note that the install procedure already does this. 

I copied this from the previous instructions of the original author and saw now that it's confusing. It just should say to copy and replace all files over again.

Share this post


Link to post
Share on other sites

Thank you @raiwa for maintaining this essential module which is current unlike the one in core.

In my test 1.0.5.1 shop on PHP 7.3 checkout_process throws;

Fatal error: Uncaught Error: Call to undefined function tep_address_format() in D:\Phoenix_1_0_5_1\htdocs\includes\modules\payment\stripe_sca.php:498 Stack trace: #0 D:\Phoenix_1_0_5_1\htdocs\includes\modules\payment\stripe_sca.php(400): stripe_sca->after_process() #1 D:\Phoenix_1_0_5_1\htdocs\includes\system\versioned\1.0.0.0\payment.php(177): stripe_sca->before_process() #2 D:\Phoenix_1_0_5_1\htdocs\checkout_process.php(88): payment->before_process() #3 {main} thrown in D:\Phoenix_1_0_5_1\htdocs\includes\modules\payment\stripe_sca.php on line 498

Fine up to 1.0.5.0 but 1.0.5.1 breaks it.

Thanks again.

Martin


Live Phoenix 1.0.5.0 on PHP 7.3

Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix 1.0.5.0) here.

Share this post


Link to post
Share on other sites

I’ll try to find time to update it if the author doesn’t.
For now, if you wants to try, compare to the changes in the core module and try to apply them.

Share this post


Link to post
Share on other sites
6 minutes ago, raiwa said:

For now, if you wants to try, compare to the changes in the core module and try to apply them.

I had a go but the core file has vast differences around that area. Winmerge showed a large number of lines missing.

These are the lines in question that I think need changing starting with line 498

                        tep_address_format($order->delivery['format_id'], $order->delivery, false, '', "\n") . "\n";
            }

            $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    tep_address_format($order->billing['format_id'], $order->billing, false, '', "\n") . "\n\n";

            $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                    EMAIL_SEPARATOR . "\n";
            $email_order .= $this->title . "\n\n";
            if ($this->email_footer) {
                $email_order .= $this->email_footer . "\n\n";
            }

            tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 


Live Phoenix 1.0.5.0 on PHP 7.3

Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix 1.0.5.0) here.

Share this post


Link to post
Share on other sites

You should just check how the removed tep_adress_format function needs to be replaced.

Edited by raiwa

Share this post


Link to post
Share on other sites
50 minutes ago, raiwa said:

You should just check how the removed tep_adress_format function needs to be replaced.

Or actually, remove the entire build email step 

// lets start with the email confirmation
            $email_order = STORE_NAME . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" .
                    EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link('account_history_info.php', 'order_id=' . $order_id, 'SSL', false) . "\n" .
                    EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
            if ($order->info['comments']) {
                $email_order .= tep_db_output($order->info['comments']) . "\n\n";
            }
            $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    $products_ordered .
                    EMAIL_SEPARATOR . "\n";

            for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
                $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
            }

            if ($order->content_type != 'virtual') {
                $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
                        EMAIL_SEPARATOR . "\n" .
                        tep_address_format($order->delivery['format_id'], $order->delivery, false, '', "\n") . "\n";
            }

            $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    tep_address_format($order->billing['format_id'], $order->billing, false, '', "\n") . "\n\n";

            $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                    EMAIL_SEPARATOR . "\n";
            $email_order .= $this->title . "\n\n";
            if ($this->email_footer) {
                $email_order .= $this->email_footer . "\n\n";
            }

            tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
            if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
                tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
            }

and replace it with

  tep_notify('checkout', $order);

as done in PayPal or in checkout_process.php. 

Edited by ecartz

Always back up before making changes.

Share this post


Link to post
Share on other sites
21 hours ago, ecartz said:

and replace it with


  tep_notify('checkout', $order);

That appears to have worked. I cannot test it fully yet as the webhook cannot respond to my XAMPP test store and fails. The emails send correctly.

I cannot update my live 1.0.5.0 store to 1.0.5.1 until most of my addons have been updated.


Live Phoenix 1.0.5.0 on PHP 7.3

Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix 1.0.5.0) here.

Share this post


Link to post
Share on other sites
45 minutes ago, mhsuffolk said:

That appears to have worked. I cannot test it fully yet as the webhook cannot respond to my XAMPP test store and fails. The emails send correctly.

I cannot update my live 1.0.5.0 store to 1.0.5.1 until most of my addons have been updated.

Can you please post your modified file and I'll try to find time to test and update the package. Thanks 👍

Share this post


Link to post
Share on other sites
2 minutes ago, raiwa said:

Can you please post your modified file and I'll try to find time to test and update the package.

Find in includes/modules/payment/stripe_sca.php

// lets start with the email confirmation
            $email_order = STORE_NAME . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" .
                    EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link('account_history_info.php', 'order_id=' . $order_id, 'SSL', false) . "\n" .
                    EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
            if ($order->info['comments']) {
                $email_order .= tep_db_output($order->info['comments']) . "\n\n";
            }
            $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    $products_ordered .
                    EMAIL_SEPARATOR . "\n";

            for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
                $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
            }

            if ($order->content_type != 'virtual') {
                $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
                        EMAIL_SEPARATOR . "\n" .
                        tep_address_format($order->delivery['format_id'], $order->delivery, false, '', "\n") . "\n";
            }

            $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    tep_address_format($order->billing['format_id'], $order->billing, false, '', "\n") . "\n\n";

            $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                    EMAIL_SEPARATOR . "\n";
            $email_order .= $this->title . "\n\n";
            if ($this->email_footer) {
                $email_order .= $this->email_footer . "\n\n";
            }

            tep_mail($order->customer['name'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
            if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
                tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, $order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address']);
            }

Replace with

// lets start with the email confirmation
	tep_notify('checkout', $order);

This is for 1.0.5.1 only. It will break in 1.0.5.0  Thanks also to @ecartz for the suggestion.


Live Phoenix 1.0.5.0 on PHP 7.3

Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix 1.0.5.0) here.

Share this post


Link to post
Share on other sites
2 hours ago, mhsuffolk said:

I cannot test it fully yet as the webhook cannot respond to my XAMPP test store and fails.

if you use the Stripe_CLI executable, as shown on the Stripe help pages, you can get the webhook to connect to the Stripe servers from a local XAMPP server.  I've done this to check my test environment.


osC CE live - developing osC Phoenix adding modules with no core changes(awesome and easy!)

Share this post


Link to post
Share on other sites

Uploaded Update

ONLY for Phoenix 1.0.5.1+

Version 1.0.15


- Updated for Phoenix 1.0.5.1+
- updated order mail. Thanks to @ecartz
- fixed some undefined notice errors
- moved includes/modules/payment/stripe_sca/ folder to includes/apps/
- updated language files. Thanks to @ecartz

Update 1.0.14 to 1.0.15:
1. copy and replace all files and folders
2. delete folder and all content:
  includes/modules/payment/stripe_sca/

Share this post


Link to post
Share on other sites
28 minutes ago, raiwa said:

ONLY for Phoenix 1.0.5.1+

Ignoring this forum and just looking in the addons market, it is not clear to newbies that this version will not work on 1.0.5.0 and below. Suggestion, could you add a message in the readme and the description?


Live Phoenix 1.0.5.0 on PHP 7.3

Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix 1.0.5.0) here.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×