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

Stripe.com payment integration module

Views: 233,167

Results 421 to 440 of 679
16 Dec 2024, 3:01 AM
#421
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Stripe.com payment integration module

Zen: 1.5.7c
PHP 7.4

I installed the stripe payment module and now PayPal Express has been impaired
on the 3rd/final checkout page, no sub total, shipping, sales tax, and Total is shown for PayPal.

The issue is the /includes/templates/template_default/templates/tpl_checkout_confirmation_default.php file
It has a section of original code commented out.
If I remove the comments, the sub total, shipping, sales tax, and Total return for PayPal

The issue is this command at line 164 is commented out and needed for PayPal:

$order_totals = $order_total_modules->process();

If it is put back, it fixes PayPal, but causes Stripe to print the sub total, shipping, sales tax, and Total twice.

ANYONE?

17 Dec 2024, 2:41 AM
#422
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

split63:

Zen: 1.5.7c
PHP 7.4

I installed the stripe payment module and now PayPal Express has been impaired
on the 3rd/final checkout page, no sub total, shipping, sales tax, and Total is shown for PayPal.

The issue is the /includes/templates/template_default/templates/tpl_checkout_confirmation_default.php file
It has a section of original code commented out.
If I remove the comments, the sub total, shipping, sales tax, and Total return for PayPal

The issue is this command at line 164 is commented out and needed for PayPal:

$order_totals = $order_total_modules->process();

> 
> If it is put back, it fixes PayPal, but causes Stripe to print the sub total, shipping, sales tax, and Total twice.
> 
> 
> ANYONE?


The reason is the low order fee.
Normally, for payments such as Paypal, customer information and payment price are sent after pressing the "confirmation order" button in checkout confirmation.
This Stripe module sends customer information and payment price when customer press the "continue" button in Checkout payment.
Therefore, Low order fee will not be added to $order->info['total'] at checkout payment.
\www\includes\modules\payment\stripe.php Lines 150-154  Checkout payment screen"Your Total" used for the payment price.
By executing lines 150-154, Sub-total, Per Item, and Total will be displayed twice on the checkout confirmation screen, so I prevent them from being displayed twice on checkout_confirmation.
If you do not use Low order fee, the solution is simple, just modify the code below.

\www\includes\modules\payment\stripe.php 150-154
```php
      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'];
        }

to

$order_value = $order->info['total'];

www\includes\templates\YOUR_TEMPLATE\templates\tpl_checkout_confirmation_default.php 158-165

/*
  if (MODULE_ORDER_TOTAL_INSTALLED) {
    $order_totals = $order_total_modules->process();

?>
<?php
  }
*/

to

  if (MODULE_ORDER_TOTAL_INSTALLED) {
    $order_totals = $order_total_modules->process();
?>
<div id="orderTotals"><?php $order_total_modules->output(); ?></div>
<?php
  }

If anyone has any other ideas, please let me know.


Nihon Yokane corporation

17 Dec 2024, 3:29 AM
#423
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Stripe.com payment integration module

What is the "Low order fee"?

Isn't that last change duplicated at line 173?...which is apparently why it was commented out (162-169)

17 Dec 2024, 5:05 AM
#424
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

split63:

What is the "Low order fee"?

Isn't that last change duplicated at line 173?...which is apparently why it was commented out (162-169)

You can set Low Order Fee at
Admin=>Modules=>Order total=>Low Order Fee

In the case of php, if it is enclosed in /* and */, it will not be executed, so there is no duplication.

17 Dec 2024, 11:12 AM
#425
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

split63:

What is the "Low order fee"?

Isn't that last change duplicated at line 173?...which is apparently why it was commented out (162-169)

Sorry, you are right.
following code is duplicated. Please erase the code.

<div id="orderTotals"><?php $order_total_modules->output(); ?></div>

and This statement is also incorrect.
\www\includes\modules\payment\stripe.php 150-154

      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'];
        }  

Correct statement is as follows
This code can support low order fees.

      if (MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true' && MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER >= $order->info['total']) {
         $order_value = $order->info['total'] + MODULE_ORDER_TOTAL_LOWORDERFEE_FEE ;
        } else{
         $order_value = $order->info['total'];
        }

It will be reflected in the next update.

17 Dec 2024, 7:32 PM
#426
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Stripe.com payment integration module

Gozzandes:

Sorry, you are right.
following code is duplicated. Please erase the code.

<div id="orderTotals"><?php $order_total_modules->output(); ?></div> ..........

It will be reflected in the next update.

I'm a little confused about what to keep and what to delete, can you attach your updated stripe.php file here?

18 Dec 2024, 3:15 AM
#427
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

split63:

I'm a little confused about what to keep and what to delete, can you attach your updated stripe.php file here?

includes\modules\payment\stripe.php

<?php
/**
 *
 * @copyright Copyright 2003-2022 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: brittainmark 2022 Sep 10 Modified in v1.5.8 $
 */
  class stripe extends base {

      /**
     * $_check is used to check the configuration key set up
     * @var int
     */
    protected $_check;
    /**
     * $code determines the internal 'code' name used to designate "this" payment module
     * @var string
     */
    public $code;
    /**
     * $description is a soft name for this payment method
     * @var string 
     */
    public $description;
    /**
     * $email_footer is the text to me placed in the footer of the email
     * @var string
     */
    public $email_footer;
    /**
     * $enabled determines whether this module shows or not... during checkout.
     * @var boolean
     */
    public $enabled;
    /**
     * $order_status is the order status to set after processing the payment
     * @var int
     */
    public $order_status;
    /**
     * $title is the displayed name for this order total method
     * @var string
     */
    public $title;
    /**
     * $sort_order is the order priority of this payment module when displayed
     * @var int
     */
    public $sort_order;

// class constructor
function __construct() {
  global $order;

  $this->code = 'stripe';
  $this->title = MODULE_PAYMENT_STRIPE_TEXT_TITLE;
  $this->description = MODULE_PAYMENT_STRIPE_TEXT_DESCRIPTION;
  $this->sort_order = defined('MODULE_PAYMENT_STRIPE_SORT_ORDER') ? MODULE_PAYMENT_STRIPE_SORT_ORDER : null;
  $this->enabled = (defined('MODULE_PAYMENT_STRIPE_STATUS') && MODULE_PAYMENT_STRIPE_STATUS == 'True');

  if (null === $this->sort_order) return false;

  if (IS_ADMIN_FLAG === true && (MODULE_PAYMENT_STRIPE_PUBLISHABLE_KEY == '' || MODULE_PAYMENT_STRIPE_SECRET_KEY == '' || MODULE_PAYMENT_STRIPE_PUBLISHABLE_TEST_KEY == '' || MODULE_PAYMENT_STRIPE_SECRET_TEST_KEY == '' )) $this->title .= '<span class="alert"> (not configured - stripe publishable key and secret key)</span>';

  if (IS_ADMIN_FLAG === true && (MODULE_PAYMENT_STRIPE_TEST_MODE == 'True')) $this->title .= '<span class="alert"> (Stripe is in testing mode)</span>';

  if (IS_ADMIN_FLAG === true && (strpos(MODULE_PAYMENT_STRIPE_PUBLISHABLE_KEY,'_test_') !== false ) == true || (strpos(MODULE_PAYMENT_STRIPE_SECRET_KEY,'_test_') !== false ) == true) $this->title .= '<span class="alert"> (Test key entered in API publishable key or secret key )</span>';

  if (IS_ADMIN_FLAG === true && (strpos(MODULE_PAYMENT_STRIPE_PUBLISHABLE_TEST_KEY,'_test_') !== false ) == false || (strpos(MODULE_PAYMENT_STRIPE_SECRET_TEST_KEY,'_test_') !== false ) == false) $this->title .= '<span class="alert"> (Test key not entered in the test mode field)</span>';

  if ((int)MODULE_PAYMENT_STRIPE_STATUS_ID > 0) {
    $this->order_status = MODULE_PAYMENT_STRIPE_STATUS_ID;
  
  }

  if (is_object($order)) $this->update_status();
  }

// class methods
function update_status() {
  global $order, $db,$amount,$payment_currency;

  if ($this->enabled && (int)MODULE_PAYMENT_STRIPE_ZONE > 0 && isset($order->billing['country']['id'])) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_STRIPE_ZONE . "' and zone_country_id = '" . (int)$order->billing['country']['id'] . "' order by zone_id");
    while (!$check->EOF) {
      if ($check->fields['zone_id'] < 1) {
        $check_flag = true;
        break;
      } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
        $check_flag = true;
        break;
      }
      $check->MoveNext();
    }

    if ($check_flag == false) {
      $this->enabled = false;
    }
  }

  // other status checks?
  if ($this->enabled) {
    // other checks here
  }
}

function javascript_validation() {
  return false;
}

function selection() {
  return array('id' => $this->code,
               'module' => $this->title);
}

function pre_confirmation_check() {
  global $order, $db,$stripeCustomerID,$user_id,$stripe_select,$order_total_modules;
   $stripe_select = 'True';
  if (MODULE_PAYMENT_STRIPE_TEST_MODE === 'True') {
      $publishable_key = MODULE_PAYMENT_STRIPE_PUBLISHABLE_TEST_KEY;
      $secret_key = MODULE_PAYMENT_STRIPE_SECRET_TEST_KEY;
      $test_mode = true;
    }else{
      $publishable_key = MODULE_PAYMENT_STRIPE_PUBLISHABLE_KEY;
      $secret_key = MODULE_PAYMENT_STRIPE_SECRET_KEY;
      $test_mode = false;
    }

  $payment_currency = $order->info['currency'];
  $Xi_currency = ['BIF','CLP','DJF','GNF','JPY','KMF','KRW','MGA','PYG','RWF','UGX','VND','VUV','XAF','XOF','XPF'];
  $Xiooo_currency = ['BHD','JOD','KWD','OMR','TND'];

  if (in_array($payment_currency,$Xi_currency) == true ) {
      $multiplied_by = 1;
      $decimal_places = 0;
    } elseif (in_array($payment_currency,$Xiooo_currency) == true ) {
      $multiplied_by = 1000;
      $decimal_places = 2;
    }else{
      $multiplied_by = 100;
      $decimal_places = 2;
    }

  if ( isset($_SESSION['opc_saved_order_total'])) {
     $order_value = $_SESSION['opc_saved_order_total'];
    }else{

      if (MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true' && MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER >= $order->info['total']) {
         $order_value = $order->info['total'] + MODULE_ORDER_TOTAL_LOWORDERFEE_FEE ;
        } else{
         $order_value = $order->info['total'];
        }  

    }
  $amount_total=round($order_value * $order->info['currency_value'],$decimal_places)*$multiplied_by;
  
  $fullname = $order->billing['firstname'].= $order->billing['lastname'];
  $email = $order->customer['email_address'];
  $user_id = $_SESSION['customer_id'];
  $registered_customer = false;
  $stripe_customer = $db->Execute("SELECT stripe_customers_id FROM " . TABLE_STRIPE . " WHERE customers_id = '" .$_SESSION['customer_id'] . "' order by id DESC LIMIT 1");
  if ($stripe_customer->RecordCount() > 0) {
  $registered_customer = true;
}
  require_once 'stripepay/create.php' ;

}

function confirmation() {
  return false;
}

function process_button() {
  return false;
}

function before_process() {
  global $order;
    $order_comment = $_SESSION['order_add_comment']."\n Stripe ID:";
    $order_comment = $order_comment . $_SESSION['paymentIntent'];
     $order->info['comments'] = $order_comment;
}

function after_process() {
     unset($_SESSION['order_add_comment']);
     unset($_SESSION['paymentIntent']);
    }

function get_error() {
  return false;
}

function check() {
  global $db;

  if (!isset($this->_check)) {
    $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_STRIPE_STATUS'");
    $this->_check = $check_query->RecordCount();
  }
  return $this->_check;
}

function install() {
  global $db, $messageStack;
  if (defined('MODULE_PAYMENT_STRIPE_STATUS')) {
    $messageStack->add_session('StMoneyOrder module already installed.', 'error');
    zen_redirect(zen_href_link(FILENAME_MODULES, 'set=payment&module=stripe', 'NONSSL'));
    return 'failed';
  }

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

  $db->Execute("insert into " . TABLE_CONFIGURATION . " (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`, `val_function`) VALUES('Enable Stripe Secure Payment Module', 'MODULE_PAYMENT_STRIPE_STATUS', 'True', 'Do you want to accept Stripe Secure Payment?', 6, 1, NULL, now(), NULL, 'zen_cfg_select_option(array(\'True\', \'False\'), ', NULL)");

  $db->Execute("insert into " . TABLE_CONFIGURATION . " (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`, `val_function`) VALUES
  ('API Publishable Key:', 'MODULE_PAYMENT_STRIPE_PUBLISHABLE_KEY', '', 'Enter API Publishable Key provided by stripe', 6, 1, NULL, now(), NULL, NULL, NULL)");

  $db->Execute("insert into " . TABLE_CONFIGURATION . " (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`, `val_function`) VALUES      
  ('Sort order of display.', 'MODULE_PAYMENT_STRIPE_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', 6, 1, NULL, now(), NULL, NULL, NULL)");

  $db->Execute("insert into " . TABLE_CONFIGURATION . " (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`, `val_function`) VALUES
  ('Payment Zone', 'MODULE_PAYMENT_STRIPE_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', 6, 1, NULL, now(), 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', NULL)");

  $db->Execute("insert into " . TABLE_CONFIGURATION . " (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`, `val_function`) VALUES      
  ('Set Order Status', 'MODULE_PAYMENT_STRIPE_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', 6, 1, NULL, now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(', NULL)");

  $db->Execute("insert into " . TABLE_CONFIGURATION . " (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`, `val_function`) VALUES
  ('API Secret Key:', 'MODULE_PAYMENT_STRIPE_SECRET_KEY', '', 'Enter API Secret Key provided by stripe', 6, 1, NULL, now(), 'zen_cfg_password_display', NULL, NULL)");

  $db->Execute("insert into " . TABLE_CONFIGURATION . " (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`, `val_function`) VALUES      
  ('Test Mode - API Publishable Test Key:', 'MODULE_PAYMENT_STRIPE_PUBLISHABLE_TEST_KEY', '', 'Enter API Publishable Test Key provided by stripe', 6, 1, NULL, now(), NULL, NULL, NULL)");

  $db->Execute("insert into " . TABLE_CONFIGURATION . " (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`, `val_function`) VALUES
  ('Test Mode - API Secret Test Key:', 'MODULE_PAYMENT_STRIPE_SECRET_TEST_KEY', '', 'Enter API Secret Test Key provided by stripe', 6, 1, NULL, now(), 'zen_cfg_password_display', NULL, NULL)");

  $db->Execute("insert into " . TABLE_CONFIGURATION . " (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`, `val_function`) VALUES      
  ('Test Mode Stripe Secure Payment Module', 'MODULE_PAYMENT_STRIPE_TEST_MODE', 'True', 'Enter your Stripe API test publishable key and secret key.\r\nNote: Don\'t forget to set it to False after testing.', 6, 1, NULL, now(), NULL, 'zen_cfg_select_option(array(\'True\', \'False\'), ', NULL)");
  
}

function remove() {
  global $db;
  $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {

  return array('MODULE_PAYMENT_STRIPE_STATUS', 'MODULE_PAYMENT_STRIPE_TEST_MODE','MODULE_PAYMENT_STRIPE_ZONE', 'MODULE_PAYMENT_STRIPE_STATUS_ID', 'MODULE_PAYMENT_STRIPE_SORT_ORDER', 'MODULE_PAYMENT_STRIPE_PUBLISHABLE_KEY','MODULE_PAYMENT_STRIPE_SECRET_KEY','MODULE_PAYMENT_STRIPE_PUBLISHABLE_TEST_KEY','MODULE_PAYMENT_STRIPE_SECRET_TEST_KEY');
}
}
18 Dec 2024, 3:33 AM
#428
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

includes\templates\YOUR_TEMPLATE\templates\tpl_checkout_confirmation_default.php

<?php
/**
 * Page Template
 *
 * Loaded automatically by index.php?main_page=checkout_confirmation.
 * Displays final checkout details, cart, payment and shipping info details.
 *
 * @copyright Copyright 2003-2023 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: Steve 2023 Feb 23 Modified in v1.5.8a $
 */
?>
<div class="centerColumn" id="checkoutConfirmDefault">

<h1 id="checkoutConfirmDefaultHeading"><?php echo HEADING_TITLE; ?></h1>

<?php if ($messageStack->size('redemptions') > 0) echo $messageStack->output('redemptions'); ?>
<?php if ($messageStack->size('checkout_confirmation') > 0) echo $messageStack->output('checkout_confirmation'); ?>
<?php if ($messageStack->size('checkout') > 0) echo $messageStack->output('checkout'); ?>

<div id="checkoutBillto" class="back">
<h2 id="checkoutConfirmDefaultBillingAddress"><?php echo HEADING_BILLING_ADDRESS; ?></h2>
<?php if (!$flagDisablePaymentAddressChange) { ?>
<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>
<?php } ?>

<address><?php echo zen_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></address>

<h3 id="checkoutConfirmDefaultPayment"><?php echo HEADING_PAYMENT_METHOD; ?></h3>
<h4 id="checkoutConfirmDefaultPaymentTitle"><?php echo $payment_title; ?></h4>

<?php
  if ($credit_covers === false && is_array($payment_modules->modules)) {
    if ($confirmation = $payment_modules->confirmation()) {
?>
<div class="important"><?php echo $confirmation['title']; ?></div>
<?php
    }
?>
<div class="important">
<?php
      for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {
?>
<div class="back"><?php echo $confirmation['fields'][$i]['title']; ?></div>
<div ><?php echo $confirmation['fields'][$i]['field']; ?></div>
<?php
     }
?>
      </div>
<?php
  }
?>

<br class="clearBoth">
</div>

<?php
  if ($_SESSION['sendto'] != false) {
?>
<div id="checkoutShipto" class="forward">
<h2 id="checkoutConfirmDefaultShippingAddress"><?php echo HEADING_DELIVERY_ADDRESS; ?></h2>
<div class="buttonRow forward"><?php echo '<a href="' . $editShippingButtonLink . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>

<address><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></address>

<?php
    if ($order->info['shipping_method']) {
?>
<h3 id="checkoutConfirmDefaultShipment"><?php echo HEADING_SHIPPING_METHOD; ?></h3>
<h4 id="checkoutConfirmDefaultShipmentTitle"><?php echo $order->info['shipping_method']; ?></h4>

<?php
    }
?>
</div>
<?php
  }
?>
<br class="clearBoth">
<hr>

<h2 id="checkoutConfirmDefaultHeadingComments"><?php echo HEADING_ORDER_COMMENTS; ?></h2>
<div class="buttonRow forward"><?php echo  '<a href="' . zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>
<div><?php echo (empty($order->info['comments']) ? NO_COMMENTS_TEXT : nl2br(zen_output_string_protected($order->info['comments'])) . zen_draw_hidden_field('comments', $order->info['comments'])); ?></div>
<br class="clearBoth">
<hr>

<h2 id="checkoutConfirmDefaultHeadingCart"><?php echo HEADING_PRODUCTS; ?></h2>

<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>
<br class="clearBoth">

<?php  if ($flagAnyOutOfStock) { ?>
<?php    if (STOCK_ALLOW_CHECKOUT == 'true') {  ?>
<div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div>
<?php    } else { ?>
<div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div>
<?php    } //endif STOCK_ALLOW_CHECKOUT ?>
<?php  } //endif flagAnyOutOfStock ?>


      <table id="cartContentsDisplay">
        <tr class="cartTableHeading">
        <th scope="col" id="ccQuantityHeading"><?php echo TABLE_HEADING_QUANTITY; ?></th>
        <th scope="col" id="ccProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
<?php
  // If there are tax groups, display the tax columns for price breakdown
  if (sizeof($order->info['tax_groups']) > 1) {
?>
          <th scope="col" id="ccTaxHeading"><?php echo HEADING_TAX; ?></th>
<?php
  }
?>
          <th scope="col" id="ccTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?></th>
        </tr>
<?php // now loop thru all products to display quantity and price ?>
<?php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { ?>
        <tr class="<?php echo $order->products[$i]['rowClass']; ?>">
          <td  class="cartQuantity"><?php echo $order->products[$i]['qty']; ?> x</td>
          <td class="cartProductDisplay"><?php echo $order->products[$i]['name']; ?>

          <?php  if (!empty($stock_check[$i])) echo $stock_check[$i]; ?>

<?php // if there are attributes, loop thru them and display one per line
    if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0 ) {
    echo '<ul class="cartAttribsList">';
      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
?>
      <li>
          <?php
          echo $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
          ?>
      </li>
<?php
      } // end loop
      echo '</ul>';
    } // endif attribute-info
?>
        </td>

<?php // display tax info if exists ?>
<?php if (sizeof($order->info['tax_groups']) > 1)  { ?>
        <td class="cartTotalDisplay">
          <?php echo zen_display_tax_value($order->products[$i]['tax']); ?>%</td>
<?php    }  // endif tax info display  ?>
        <td class="cartTotalDisplay">
          <?php echo $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']);
          if ($order->products[$i]['onetime_charges'] != 0 ) echo '<br> ' . $currencies->display_price($order->products[$i]['onetime_charges'], $order->products[$i]['tax'], 1);
?>
        </td>
      </tr>
<?php  }  // end for loopthru all products ?>
      </table>
      <hr>

<?php
  if (MODULE_ORDER_TOTAL_INSTALLED) {
    $order_totals = $order_total_modules->process();
?>
<div id="orderTotals"><?php $order_total_modules->output(); ?></div>
<?php
  }
?>

<!--------stripe-------->
<!-- Display a payment form -->
    <form id="payment-form">
    <div id="payment-head" style="color: #2254dd;  font-size: 24px;  font-weight: bold; margin:24px 0 12px;">Stripe</div>    
    <div id="payment-element">
        <!--Stripe.js injects the Payment Element-->
      </div>
      <div id="payment-message" class="hidden"></div>
      <button id="submit">
      <div class="spinner hidden" id="spinner"></div>
        <span id="button-text"><?php echo BUTTON_CONFIRM_ORDER_ALT; ?></span>
      </button>
      </form>   
<!--------end-stripe-------->

<?php
  echo zen_draw_form('checkout_confirmation', $form_action_url, 'post', 'id="checkout_confirmation" onsubmit="submitonce();"');

  if ($credit_covers === false && is_array($payment_modules->modules)) {
    echo $payment_modules->process_button();
  }
?>
<div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_CONFIRM_ORDER, BUTTON_CONFIRM_ORDER_ALT, 'name="btn_submit" id="btn_submit"') ;?></div>
</form>
<div class="buttonRow back"><?php echo '<strong>' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</strong>' . '<br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></div>

</div>

<!--------stripe-------->
<script>

if (typeof clientS === 'undefined') {

    document.getElementById('btn_submit').display ="block";
    document.getElementById('checkout_confirmation').display ="block";
    document.getElementById('payment-form','submit').style.display ="none";
  }else{
    document.getElementById('btn_submit').style.display ="none";
    document.getElementById('checkout_confirmation').style.display ="none";
    document.getElementById('payment-form','submit').display ="block";

  }
</script>
<!--------end-stripe-------->
19 Dec 2024, 12:49 AM
#429
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Stripe.com payment integration module

Gozzandes:

includes\templates\YOUR_TEMPLATE\templates\tpl_checkout_confirmation_default.php

The source of that file appears to be the 1.5.8 stripe version. Will that also work for 1.5.7c?

19 Dec 2024, 1:13 AM
#430
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

split63:

The source of that file appears to be the 1.5.8 stripe version. Will that also work for 1.5.7c?

Paste following code from line 169

<!--------stripe-------->
<!-- Display a payment form -->
    <form id="payment-form">
    <div id="payment-head" style="color: #2254dd;  font-size: 24px;  font-weight: bold; margin:24px 0 12px;">Stripe</div>    
    <div id="payment-element">
        <!--Stripe.js injects the Payment Element-->
      </div>
      <div id="payment-message" class="hidden"></div>
      <button id="submit">
      <div class="spinner hidden" id="spinner"></div>
        <span id="button-text"><?php echo BUTTON_CONFIRM_ORDER_ALT; ?></span>
      </button>
      </form>   
<!--------end-stripe-------->

Paste this code below the last line.

<!--------stripe-------->
<script>
if (typeof clientS === 'undefined') {

    document.getElementById('btn_submit').display ="block";
    document.getElementById('checkout_confirmation').display ="block";
    document.getElementById('payment-form','submit').style.display ="none";
  }else{
    document.getElementById('btn_submit').style.display ="none";
    document.getElementById('checkout_confirmation').style.display ="none";
    document.getElementById('payment-form','submit').display ="block";

  }
</script>
<!--------end-stripe-------->
19 Dec 2024, 3:22 PM
#431
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Stripe.com payment integration module

I pasted both those segments over the existing stripe 1.5.7d segments. Now both PayPal and Stripe no longer show Sub Total, Tax, Total on the final checkout page

I also tried the complete file sourced from 1.5.8, expecting it to fail, the PayPal was fixed, but the Stripe had duplicated Sub Total, Tax, Total on the final checkout page

19 Dec 2024, 11:25 PM
#432
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

split63:

I pasted both those segments over the existing stripe 1.5.7d segments. Now both PayPal and Stripe no longer show Sub Total, Tax, Total on the final checkout page

I also tried the complete file sourced from 1.5.8, expecting it to fail, the PayPal was fixed, but the Stripe had duplicated Sub Total, Tax, Total on the final checkout page

Check you template select.
and following codes are for ver zen cart 157c template_default

<?php
/**
 * Page Template
 *
 * Loaded automatically by index.php?main_page=checkout_confirmation.<br />
 * Displays final checkout details, cart, payment and shipping info details.
 *
 * @copyright Copyright 2003-2020 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: DrByte 2020 Oct 19 Modified in v1.5.7a $
 */
?>
<div class="centerColumn" id="checkoutConfirmDefault">

<h1 id="checkoutConfirmDefaultHeading"><?php echo HEADING_TITLE; ?></h1>

<?php if ($messageStack->size('redemptions') > 0) echo $messageStack->output('redemptions'); ?>
<?php if ($messageStack->size('checkout_confirmation') > 0) echo $messageStack->output('checkout_confirmation'); ?>
<?php if ($messageStack->size('checkout') > 0) echo $messageStack->output('checkout'); ?>

<div id="checkoutBillto" class="back">
<h2 id="checkoutConfirmDefaultBillingAddress"><?php echo HEADING_BILLING_ADDRESS; ?></h2>
<?php if (!$flagDisablePaymentAddressChange) { ?>
<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>
<?php } ?>

<address><?php echo zen_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br />'); ?></address>

<?php
  $class =& $_SESSION['payment'];
?>

<h3 id="checkoutConfirmDefaultPayment"><?php echo HEADING_PAYMENT_METHOD; ?></h3>
<h4 id="checkoutConfirmDefaultPaymentTitle"><?php echo $GLOBALS[$class]->title; ?></h4>

<?php
  if (is_array($payment_modules->modules)) {
    if ($confirmation = $payment_modules->confirmation()) {
?>
<div class="important"><?php echo $confirmation['title']; ?></div>
<?php
    }
?>
<div class="important">
<?php
      for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {
?>
<div class="back"><?php echo $confirmation['fields'][$i]['title']; ?></div>
<div ><?php echo $confirmation['fields'][$i]['field']; ?></div>
<?php
     }
?>
      </div>
<?php
  }
?>

<br class="clearBoth" />
</div>

<?php
  if ($_SESSION['sendto'] != false) {
?>
<div id="checkoutShipto" class="forward">
<h2 id="checkoutConfirmDefaultShippingAddress"><?php echo HEADING_DELIVERY_ADDRESS; ?></h2>
<div class="buttonRow forward"><?php echo '<a href="' . $editShippingButtonLink . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>

<address><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br />'); ?></address>

<?php
    if ($order->info['shipping_method']) {
?>
<h3 id="checkoutConfirmDefaultShipment"><?php echo HEADING_SHIPPING_METHOD; ?></h3>
<h4 id="checkoutConfirmDefaultShipmentTitle"><?php echo $order->info['shipping_method']; ?></h4>

<?php
    }
?>
</div>
<?php
  }
?>
<br class="clearBoth" />
<hr />

<h2 id="checkoutConfirmDefaultHeadingComments"><?php echo HEADING_ORDER_COMMENTS; ?></h2>
<div class="buttonRow forward"><?php echo  '<a href="' . zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>
<div><?php echo (empty($order->info['comments']) ? NO_COMMENTS_TEXT : nl2br(zen_output_string_protected($order->info['comments'])) . zen_draw_hidden_field('comments', $order->info['comments'])); ?></div>
<br class="clearBoth" />
<hr />

<h2 id="checkoutConfirmDefaultHeadingCart"><?php echo HEADING_PRODUCTS; ?></h2>

<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>
<br class="clearBoth" />

<?php  if ($flagAnyOutOfStock) { ?>
<?php    if (STOCK_ALLOW_CHECKOUT == 'true') {  ?>
<div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div>
<?php    } else { ?>
<div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div>
<?php    } //endif STOCK_ALLOW_CHECKOUT ?>
<?php  } //endif flagAnyOutOfStock ?>


      <table id="cartContentsDisplay">
        <tr class="cartTableHeading">
        <th scope="col" id="ccQuantityHeading"><?php echo TABLE_HEADING_QUANTITY; ?></th>
        <th scope="col" id="ccProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
<?php
  // If there are tax groups, display the tax columns for price breakdown
  if (sizeof($order->info['tax_groups']) > 1) {
?>
          <th scope="col" id="ccTaxHeading"><?php echo HEADING_TAX; ?></th>
<?php
  }
?>
          <th scope="col" id="ccTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?></th>
        </tr>
<?php // now loop thru all products to display quantity and price ?>
<?php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { ?>
        <tr class="<?php echo $order->products[$i]['rowClass']; ?>">
          <td  class="cartQuantity"><?php echo $order->products[$i]['qty']; ?> x</td>
          <td class="cartProductDisplay"><?php echo $order->products[$i]['name']; ?>

          <?php  if (!empty($stock_check[$i])) echo $stock_check[$i]; ?>

<?php // if there are attributes, loop thru them and display one per line
    if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0 ) {
    echo '<ul class="cartAttribsList">';
      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
?>
      <li>
          <?php
          echo $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
          ?>
      </li>
<?php
      } // end loop
      echo '</ul>';
    } // endif attribute-info
?>
        </td>

<?php // display tax info if exists ?>
<?php if (sizeof($order->info['tax_groups']) > 1)  { ?>
        <td class="cartTotalDisplay">
          <?php echo zen_display_tax_value($order->products[$i]['tax']); ?>%</td>
<?php    }  // endif tax info display  ?>
        <td class="cartTotalDisplay">
          <?php echo $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']);
          if ($order->products[$i]['onetime_charges'] != 0 ) echo '<br /> ' . $currencies->display_price($order->products[$i]['onetime_charges'], $order->products[$i]['tax'], 1);
?>
        </td>
      </tr>
<?php  }  // end for loopthru all products ?>
      </table>
      <hr />

<?php
  if (MODULE_ORDER_TOTAL_INSTALLED) {
    $order_totals = $order_total_modules->process();
?>
<div id="orderTotals"><?php $order_total_modules->output(); ?></div>
<?php
  }
?>

<!--------stripe-------->
<!-- Display a payment form -->
    <form id="payment-form">
    <div id="payment-head" style="color: #2254dd;  font-size: 24px;  font-weight: bold; margin:24px 0 12px;">Stripe</div>    
    <div id="payment-element">
        <!--Stripe.js injects the Payment Element-->
      </div>
      <div id="payment-message" class="hidden"></div>
      <button id="submit">
      <div class="spinner hidden" id="spinner"></div>
        <span id="button-text"><?php echo BUTTON_CONFIRM_ORDER_ALT; ?></span>
      </button>
      </form>   
<!--------end-stripe-------->

<?php
  echo zen_draw_form('checkout_confirmation', $form_action_url, 'post', 'id="checkout_confirmation" onsubmit="submitonce();"');

  if (is_array($payment_modules->modules)) {
    echo $payment_modules->process_button();
  }
?>
<div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_CONFIRM_ORDER, BUTTON_CONFIRM_ORDER_ALT, 'name="btn_submit" id="btn_submit"') ;?></div>
</form>
<div class="buttonRow back"><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '<br />' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></div>

</div>
<!--------stripe-------->
<script>
if (typeof clientS === 'undefined') {

    document.getElementById('btn_submit').display ="block";
    document.getElementById('checkout_confirmation').display ="block";
    document.getElementById('payment-form','submit').style.display ="none";
  }else{
    document.getElementById('btn_submit').style.display ="none";
    document.getElementById('checkout_confirmation').style.display ="none";
    document.getElementById('payment-form','submit').display ="block";

  }
</script>
<!--------end-stripe-------->  
19 Dec 2024, 11:50 PM
#433
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Stripe.com payment integration module

Gozzandes:

Check you template select.
and following codes are for ver zen cart 157c template_default

I just replaced the contents of tpl_checkout_confirmation_default.php with that which you posted, and the results were the same. PayPal good, Stripe Sub total, tax, total, duplicated

I'm using the Responsive Classic template.

Same result as using the 1.5.8 version. What was interesting about the 1.5.8 version was it seemed to function without throwing PHP errors. Would you expect the 1.5.8 version of tpl_checkout_confirmation_default.php to operate correctly on version 1.5.7c?

20 Dec 2024, 12:15 AM
#434
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Stripe.com payment integration module

I just did a file compare of the contents you just posted against the original file in Stripe_module_zc157d. They are identical

So I'm now confused.

20 Dec 2024, 5:12 AM
#435
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

split63:

I just did a file compare of the contents you just posted against the original file in Stripe_module_zc157d. They are identical

So I'm now confused.

Download from github.com.
The moule for zen cart 1.5.7c is included.
zencart-stripe-module_217
Be careful "mysql_upgrade_to_2.1.7" should be install before over writing the files at Admin=>Tools=>Install SQL patches.

Niho Yokane corporation

20 Dec 2024, 4:49 PM
#436
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: Stripe.com payment integration module

I updated the files from github. It was not until I replaced the \includes\modules\payment\stripe.php, that both PayPal and Stripe now show the final checkout page correctly.
I'll need to do more testing to be sure.

However, in stripe test mode, at the stripe dashboard, orders were coming in $5 more than they should have
Checking the "low order fee" module, the low order fee was set to false, but the fee amount was set to $5. Setting this to $0 solved the additional $5 at the stripe dashboard

Attachment 20829

21 Dec 2024, 2:24 AM
#437
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

split63:

I updated the files from github. It was not until I replaced the \includes\modules\payment\stripe.php, that both PayPal and Stripe now show the final checkout page correctly.
I'll need to do more testing to be sure.

However, in stripe test mode, at the stripe dashboard, orders were coming in $5 more than they should have
Checking the "low order fee" module, the low order fee was set to false, but the fee amount was set to $5. Setting this to $0 solved the additional $5 at the stripe dashboard

Attachment 20829

Thanks!!
Change the following code
www\includes\modules\payment\stripe.php line 150
from

    if (MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true' && MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER >= $order->info['total']) {

to

    if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true' && MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER >= $order->info['total']) {

:blush:

23 Dec 2024, 3:08 AM
#439
carlwhat avatar

carlwhat

zennedOut

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

Re: Stripe.com payment integration module

Gozzandes:

I've fixed the file.
zencart-stripe-module_218

Nihon Yokane corporation

is there any way you can spend a bit of time learning github?

posting a zip file with all of the files within it is not the best way to make use of a collaborative tool such as github.

all of the files should be up on a repo, and then you can do releases where git will automatically create a zip file for you.

23 Dec 2024, 3:42 AM
#440
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

carlwhat:

is there any way you can spend a bit of time learning github?

posting a zip file with all of the files within it is not the best way to make use of a collaborative tool such as github.

all of the files should be up on a repo, and then you can do releases where git will automatically create a zip file for you.

I apologize for not being familiar with github.
I tried to upload it to github, but it does not not accept more than 100 files, so I uploaded it as a zip file.
Now, what should we do?