Forums / Addon Payment Modules / Stripe.com payment integration module

Stripe.com payment integration module

Views: 234,116

Results 621 to 640 of 680
3 Nov 2025, 10:18 PM
#621
flappingfish avatar

flappingfish

Zen Follower

Join Date:
Nov 2020
Posts:
319
Plugin Contributions:
4

Stripe.com payment integration module

barco57:

I am using the latest here: https://www.zen-cart.com/downloads.php?do=file&id=1548

includes/modules/payment/stripepay/create.php

take a backup of your current version and then replace the contents of yours with...

<?php

require 'includes/modules/payment/stripepay/vendor/autoload.php';

\Stripe\Stripe::setApiKey($secret_key);

try {
global $db,$output,$param_json;
  if ($registered_customer == false && $test_mode == false){
 
    $customer = \Stripe\Customer::create([
    'email' => $email,
    'name'   => $fullname,
    ]);

    $stripeCustomerID = $customer->id;  
    
   $sql = "INSERT INTO " . TABLE_STRIPE . " (id,customers_id,Stripe_Customers_id)  VALUES (NULL,:custID, :stripeCID )";
    $sql = $db->bindVars($sql, ':custID', $_SESSION['customer_id'], 'integer');
    $sql = $db->bindVars($sql, ':stripeCID', $stripeCustomerID, 'string');
    $db->Execute($sql);

}elseif ($test_mode == false){
    $stripeCustomerID = $stripe_customer->fields['stripe_customers_id'];
}


  // Create a PaymentIntent with amount and currency
if ($test_mode == false){
    $paymentIntent = \Stripe\PaymentIntent::create([
        'amount' => $amount_total,
        'currency' => $payment_currency,
        'customer' => $stripeCustomerID,
        'automatic_payment_methods' => [
        'enabled' => true,
        ],
    ]);
}else{
    $paymentIntent = \Stripe\PaymentIntent::create([
        'amount' => $amount_total,
        'currency' => $payment_currency,
        'automatic_payment_methods' => [
        'enabled' => true,
        ],
    ]);
}


    $output = [
        'clientSecret' => $paymentIntent->client_secret,
    ];

    $clientS_json = json_encode($output); 

} catch (Error $e) {
    http_response_code(500);
    $clientS_json =json_encode(['error' => $e->getMessage()]);
}
   
$jason_publishable_key = json_encode($publishable_key);
$jason_PaymentSuccess = json_encode(TEXT_PAYMENT_STRIPE_SUCCESS);
$confirmationURL = '"' . HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . 'index.php?main_page=checkout_confirmation"';

//---comments---
if($order->info['comments']!=""){
$order_add_comment = $order->info['comments'];
$_SESSION['order_add_comment'] = $order_add_comment;
}else{
$_SESSION['order_add_comment'] = "";
}
    $_SESSION['paymentIntent'] = $paymentIntent['id'];

//echo $paymentIntent['id'];
//------------
?>
<script>
   'use strict';
    var clientS = JSON.parse('<?php echo $clientS_json; ?>'); 
    var PublishableKey = JSON.parse('<?php echo $jason_publishable_key; ?>'); 
    var confirmationURL = JSON.parse('<?php echo $confirmationURL; ?>'); 
    var PaymentSuccess = JSON.parse('<?php echo $jason_PaymentSuccess; ?>'); 

</script>

as that is the version i am using at the moment. let me know results

3 Nov 2025, 10:25 PM
#622
flappingfish avatar

flappingfish

Zen Follower

Join Date:
Nov 2020
Posts:
319
Plugin Contributions:
4

Re: Stripe.com payment integration module

actually, now i recall, it may be the checkout.js if the above file is a match to what you already have then try checking if there is a difference between your /includes/checkout.js and the following version...

const stripe = Stripe (PublishableKey);

let elements;

initialize();
checkStatus();

document
  .querySelector("#payment-form")
  .addEventListener("submit", handleSubmit);

// Fetches a payment intent and captures the client secret
async function initialize(){
  const { clientSecret } = await clientS; 
  //   const { clientSecret } =await fetch("/create.php", {
  //   method: "POST",
  //   headers: { "Content-Type": "application/json" },
  //   body: JSON.stringify({ items }),
  // }).then((r) => r.json());

  
  elements = stripe.elements({ clientSecret });

  const paymentElementOptions = {
    layout: "tabs",
  };

  const paymentElement = elements.create("payment", paymentElementOptions);
  paymentElement.mount("#payment-element");
}

async function handleSubmit(e) {
  e.preventDefault();
  setLoading(true);

  const response = await stripe.confirmPayment({
    elements,
    confirmParams: {
      return_url: confirmationURL,
     },
    redirect: 'if_required'
   }
  )
  
   if (response.error) {
    showMessage(response.error.message);
   } else {
    document.getElementById('checkoutConfirmDefaultHeading').textContent = PaymentSuccess;
    showMessage(PaymentSuccess);
    document.getElementById("btn_submit").click();
}
  setLoading(false);
}

// Fetches the payment intent status after payment submission
async function checkStatus() {
  const clientSecret = new URLSearchParams(window.location.search).get(
    "payment_intent_client_secret"
  );

  if (!clientSecret) {
    return;
  }

  const { paymentIntent } = await stripe.retrievePaymentIntent(clientSecret);

  switch (paymentIntent.status) {
    case "succeeded":
      document.getElementById('checkoutConfirmDefaultHeading').textContent = PaymentSuccess;
      showMessage(PaymentSuccess);
      document.getElementById("btn_submit").click();
      break;
    case "processing":
      document.getElementById('checkoutConfirmDefaultHeading').textContent='Your payment is processing.';
      showMessage("Your payment is processing.");
      break;
    case "requires_payment_method":
      document.getElementById('checkoutConfirmDefaultHeading').textContent='Your payment was not successful, please try again.';
      showMessage("Your payment was not successful, please try again.");
      break;
    default:
      document.getElementById('checkoutConfirmDefaultHeading').textContent='Something went wrong.';
      showMessage("Something went wrong.");
      break;
  }
}

// ------- UI helpers -------

function showMessage(messageText) {
  const messageContainer = document.querySelector("#payment-message");

  messageContainer.classList.remove("hidden");
  messageContainer.textContent = messageText;

  setTimeout(function () {
    messageContainer.classList.add("hidden");
    messageText.textContent = "";
  }, 4000);
}

// Show a spinner on payment submission
function setLoading(isLoading) {
  if (isLoading) {
    // Disable the button and show a spinner
    document.querySelector("#submit").disabled = true;
    document.querySelector("#spinner").classList.remove("hidden");
    document.querySelector("#button-text").classList.add("hidden");
  } else {
    document.querySelector("#submit").disabled = false;
    document.querySelector("#spinner").classList.add("hidden");
    document.querySelector("#button-text").classList.remove("hidden");
  }
}
6 Nov 2025, 11:11 PM
#623
notset4life avatar

notset4life

Zen Follower

Join Date:
Sep 2004
Posts:
177
Plugin Contributions:
0

Re: Stripe.com payment integration module

There are a lot of pages here, and maybe this has been answered

If a customer has previously paid via stripe, when they go to order again, it says stripe payment.

There doesn't seem a way for the customer to REMOVE the payment method in their account (privacy concerns)

Any thoughts?

9 Nov 2025, 2:40 AM
#624
notset4life avatar

notset4life

Zen Follower

Join Date:
Sep 2004
Posts:
177
Plugin Contributions:
0

Re: Stripe.com payment integration module

notset4life:

There are a lot of pages here, and maybe this has been answered

If a customer has previously paid via stripe, when they go to order again, it says stripe payment.

There doesn't seem a way for the customer to REMOVE the payment method in their account (privacy concerns)

Any thoughts?

Disgrard, looks like it wasn't installed correctly.

9 Nov 2025, 3:10 AM
#625
notset4life avatar

notset4life

Zen Follower

Join Date:
Sep 2004
Posts:
177
Plugin Contributions:
0

Re: Stripe.com payment integration module

On main_page=checkout_confirmation

First and last name shows as

FirstFirst Last

How to fix?

10 Nov 2025, 1:15 PM
#626
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,114
Plugin Contributions:
56

Re: Stripe.com payment integration module

v3.0.0 of the Stripe payment module is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=1548

This version totally restructures the payment module's files and drops support for Zen Cart versions prior to 1.5.7.

Upgrading from a previous version, see the following wiki article for details: https://github.com/lat9/stripe/wiki/Upgrading-from-a-Version-Prior-to-v3.0.0

P.S. Apologies to @Gozzandes for taking this over, but you've not been on the forums since last August.

11 Nov 2025, 6:54 AM
#627
retched avatar

retched

Totally Zenned

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

Re: Stripe.com payment integration module

lat9:

v3.0.0 of the Stripe payment module is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=1548

This version totally restructures the payment module's files and drops support for Zen Cart versions prior to 1.5.7.

Upgrading from a previous version, see the following wiki article for details: https://github.com/lat9/stripe/wiki/Upgrading-from-a-Version-Prior-to-v3.0.0

P.S. Apologies to @Gozzandes for taking this over, but you've not been on the forums since last August.

Oh that explains a bit then. Thanks Lat9.

11 Nov 2025, 4:18 PM
#628
notset4life avatar

notset4life

Zen Follower

Join Date:
Sep 2004
Posts:
177
Plugin Contributions:
0

Re: Stripe.com payment integration module

Thanks for that. Can you tell me how to fix the checkout button?

It's tiny, on the left, and doesn't match theme, and overpowered by the powered by text

https://jumpshare.com/s/s4T0Dr1r8fHPGw9SA5Ux

I understand CSS, just not where to place it

thanks
Vin

11 Nov 2025, 4:55 PM
#629
notset4life avatar

notset4life

Zen Follower

Join Date:
Sep 2004
Posts:
177
Plugin Contributions:
0

Re: Stripe.com payment integration module

notset4life:

Thanks for that. Can you tell me how to fix the checkout button?

It's tiny, on the left, and doesn't match theme, and overpowered by the powered by text

https://jumpshare.com/s/s4T0Dr1r8fHPGw9SA5Ux

I understand CSS, just not where to place it

thanks
Vin

And second error, after clicking that little submit button, another submit button appears, (my style the way it should look)

https://jumpshare.com/s/cUugxDfHANY5usz78clw

11 Nov 2025, 6:22 PM
#630
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,114
Plugin Contributions:
56

Re: Stripe.com payment integration module

notset4life:

Thanks for that. Can you tell me how to fix the checkout button?

It's tiny, on the left, and doesn't match theme, and overpowered by the powered by text

https://jumpshare.com/s/s4T0Dr1r8fHPGw9SA5Ux

I understand CSS, just not where to place it

thanks
Vin
Did you copy the /includes/templates/YOUR_TEMPLATE/css/stylesheet_stripe.php to (er) your template's /css directory?

11 Nov 2025, 6:23 PM
#631
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,114
Plugin Contributions:
56

Re: Stripe.com payment integration module

notset4life:

And second error, after clicking that little submit button, another submit button appears, (my style the way it should look)

https://jumpshare.com/s/cUugxDfHANY5usz78clw
That second submit will show for a small amount of time; that's the submit button that starts the order's successful processing and "should be" auto-submitted.

11 Nov 2025, 7:22 PM
#632
notset4life avatar

notset4life

Zen Follower

Join Date:
Sep 2004
Posts:
177
Plugin Contributions:
0

Re: Stripe.com payment integration module

lat9:

Did you copy the /includes/templates/YOUR_TEMPLATE/css/stylesheet_stripe.php to (er) your template's /css directory?

Looks like I added it to ADMIN folder. I moved it and it's fixed. The showing for a small amount of time meant that there were two submit buttons, the unstyled one and the styled one appearing after click. OK now. Thanks

5 Dec 2025, 4:26 PM
#633
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,186
Plugin Contributions:
0

Re: Stripe.com payment integration module

Zen Cart 2.2
Php Version: 8.4
OPC

Under your Notes:
4. If your site uses One-Page Checkout (OPC), you must add stripe to the comma-separated list of payment methods requiring confirmation (Configuration :: One-Page Checkout Settings :: Payment Methods Requiring Confirmation).

By default in the One Page Checkout Settings:
Default: eway_rapid,stripepay,gps

Are we good to GO ??????

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

5 Dec 2025, 4:52 PM
#634
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,114
Plugin Contributions:
56

Re: Stripe.com payment integration module

haredo:

Zen Cart 2.2
Php Version: 8.4
OPC

Under your Notes:
4. If your site uses One-Page Checkout (OPC), you must add stripe to the comma-separated list of payment methods requiring confirmation (Configuration :: One-Page Checkout Settings :: Payment Methods Requiring Confirmation).

By default in the One Page Checkout Settings:
Default: eway_rapid,stripepay,gps

Are we good to GO ??????
No, you need to add ,stripe to the list.

5 Dec 2025, 5:16 PM
#635
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,186
Plugin Contributions:
0

Re: Stripe.com payment integration module

Thank you !

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

9 Dec 2025, 8:01 PM
#636
mario75 avatar

mario75

New Zenner

Join Date:
May 2012
Posts:
22
Plugin Contributions:
0

Re: Stripe.com payment integration module

Hi! Thank you for a great plugin and for all the work put into making it and resolving all the errors and requests from the community! I really appreciate it! But I need some help!
I'm using Zen-Cart v1.5.7c. Therefore I had to use Stripe.com Payments Integration Version 2.1.14 from Zen-Cart plugin section, as it is the latest one that supports my version of ZC.

All went well for a few months, the payments were processed correctly until the day I wanted to use a discount coupon. Zen-Cart showed the correct amount on the checkout page (I'm using the standard three pages checkout system), but Stripe received the amount without the discount and the client paid the full amount without the discount.

I have read the entire topic and I have found that this problem was also reported much earlier than version 2.1.14 of the plugin, and they were told that this would be addressed and corrected in later versions.
But here I am, with no immediate plans to upgrade Zen-Cart, having the same problem with discount coupon not being included in the amount that Stripe requests from client.
I have also read about editing the function pre_confirmation_check() { but I'm not sure what to edit, or if I should edit at all, and also about using ```
$calculatedTotal = $order_total_modules->pre_confirmation_check(true);

Thank you in advance!
12 Dec 2025, 11:04 PM
#637
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,186
Plugin Contributions:
0

Re: Stripe.com payment integration module

Zen Cart 2.2.0
Php Version 8.4
OPC
Bootstrap

Cindy,
I received a stripe payment order today and noticed when I went into my admin panel I found this in the debug folder

[12-Dec-2025 14:47:57 America/Chicago] Request URI: /index.php?main_page=checkout_one_confirmation, IP address: 216.177.186.199, Language id 1
#0 /includes/modules/payment/stripepay/create.php(71): zen_debug_error_handler()
#1 /includes/modules/pages/checkout_one_confirmation/jscript_stripe_checkout_one_confirmation.php(6): require('/home/haremark/...')
#2 /includes/templates/template_default/common/html_header_js_loader.php(58): require('/home/xxxxxxxx/...')
#3 /includes/templates/boot_haredo220/common/html_header_js_loader.php(26): require('/home/xxxxxxxx/...')
#4 /includes/templates/boot_haredo220/common/html_header.php(158): require('/home/xxxxxxxx/...')
#5 /index.php(48): require('/home/xxxxxxxxx/...')
--> PHP Warning: Undefined array key "stripe_customers_id" in /includes/modules/payment/stripepay/create.php on line 71.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

14 Dec 2025, 3:40 PM
#638
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,114
Plugin Contributions:
56

Re: Stripe.com payment integration module

haredo:

Zen Cart 2.2.0
Php Version 8.4
OPC
Bootstrap

Cindy,
I received a stripe payment order today and noticed when I went into my admin panel I found this in the debug folder

[12-Dec-2025 14:47:57 America/Chicago] Request URI: /index.php?main_page=checkout_one_confirmation, IP address: 216.177.186.199, Language id 1
#0 /includes/modules/payment/stripepay/create.php(71): zen_debug_error_handler()
#1 /includes/modules/pages/checkout_one_confirmation/jscript_stripe_checkout_one_confirmation.php(6): require('/home/haremark/...')
#2 /includes/templates/template_default/common/html_header_js_loader.php(58): require('/home/xxxxxxxx/...')
#3 /includes/templates/boot_haredo220/common/html_header_js_loader.php(26): require('/home/xxxxxxxx/...')
#4 /includes/templates/boot_haredo220/common/html_header.php(158): require('/home/xxxxxxxx/...')
#5 /index.php(48): require('/home/xxxxxxxxx/...')
--> PHP Warning: Undefined array key "stripe_customers_id" in /includes/modules/payment/stripepay/create.php on line 71.
Try changing line 71 of that file from

        $stripeCustomerID = $stripe_customer->fields['stripe_customers_id'];

to

        $stripeCustomerID = $stripe_customer->fields['[B]S[/B]tripe_[B]C[/B]ustomers_id'];
14 Dec 2025, 5:21 PM
#639
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,186
Plugin Contributions:
0

Re: Stripe.com payment integration module

Thank you !!

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

9 Jan 2026, 7:11 PM
#640
dustie avatar

dustie

Zen Follower

Join Date:
Nov 2010
Posts:
159
Plugin Contributions:
0

Re: Stripe.com payment integration module

HI,

I have tried to find a solution to my problem but can't, so here I am with my problem.

My ZC is Zen Cart 2.1.0 (new installation). Template Bootstrap. Mods, only Sales Report and Admin Customer Login

My issue is with the payment method. I have the newest version of Stripe. Problem is, if I install Paypal Express, the Stripe doesn't show up under payment method. I know it's working because if I install Paypal Standard, both Stripe and Paypal show up and both work. If I delete STandard and install Express, Stripe is gone!

I believe the Paypal standard is now outdated so I would prefer to use Paypal Express. I have uninstalled both and reinstalled and issue is the same.

Any help would be appreciated.

Thanks