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

Stripe.com payment integration module

Views: 233,161

Results 521 to 540 of 679
13 Jan 2025, 5:40 AM
#521
split63 avatar

split63

Totally Zenned

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

Stripe.com payment integration module

Gozzandes, Sorry that BigB and I are tugging you back and forth, but I wanted to mention that I re-enabled Stripe, but with only Credit Cards enabled....no other changes. So far, every order received has resulted in a Zen Order and a successful stripe payment. Whereas starting on the 10th, none of the non-CC orders had a Zen order, which prompted the initial disabling of Stripe.

13 Jan 2025, 12:11 PM
#522
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

BigB:

OK... Right now all test orders are "pending". Not sure what they should be changed to... the other choices are* processing, delivered* or update.
Should this be done before I update the stripe module to version 2.1.11 or after I update the module?

Go to admin=>Payment Modules => Stripe Payments => Set Order Status
Change the Set Order Status "default" to "Delivered".

13 Jan 2025, 6:50 PM
#523
bigb avatar

bigb

New Zenner

Join Date:
Jun 2024
Posts:
91
Plugin Contributions:
0

Re: Stripe.com payment integration module

Gozzandes:

Go to admin=>Payment Modules => Stripe Payments => Set Order Status
Change the Set Order Status "default" to "Delivered".

OK, completed the tasks of updating the module as per your guidance... I then un-installed the module in ZC admin and re-installed it... set the status of the module's admin settings from "default" to "delivered" and added the stripe test credentials.
The entire checkout process worked smooth and flawlessly.
All steps of checkout were seemless with ability to download a digital product after CC info entered and order confirmed during checkout.
Thank you Gozzandes. All of your difection and instruction has been spot on. I greatly appreciate your assistance :cheers:

13 Jan 2025, 8:40 PM
#524
bigb avatar

bigb

New Zenner

Join Date:
Jun 2024
Posts:
91
Plugin Contributions:
0

Re: Stripe.com payment integration module

Something odd that's been happening..when I check on the orders at Stripe every transaction has an additional $5.00 USD charge added to it.
For example: I have a $10.00 test product in the Zen Cart store... when purchasing the product it shows the correct price of $10.00 to be charged in checkout however, when I check the completed transactions back at my Stripe account it is a $15.00 transaction... every test order has this $5.00 added to it. Has anyone else had this issue or know why this may be happening?
I don't knpw if the charge is occuring at Stripe or in Zen Cart.
I have disabled Flat Rate shippping module and there is no shipping/handling fee being applied in the product listing. I'm trying to track down why/how this charge is occuring but have not been able to figure it out yet. Any input or suggestion on where to look and/or what to do is greatly appreciated, thanks

13 Jan 2025, 9:06 PM
#525
split63 avatar

split63

Totally Zenned

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

Re: Stripe.com payment integration module

BigB:

Something odd that's been happening..when I check on the orders at Stripe every transaction has an additional $5.00 USD charge added to it.
For example: I have a $10.00 test product in the Zen Cart store... when purchasing the product it shows the correct price of $10.00 to be charged in checkout however, when I check the completed transactions back at my Stripe account it is a $15.00 transaction... every test order has this $5.00 added to it. Has anyone else had this issue or know why this may be happening?
I don't knpw if the charge is occuring at Stripe or in Zen Cart.
I have disabled Flat Rate shippping module and there is no shipping/handling fee being applied in the product listing. I'm trying to track down why/how this charge is occuring but have not been able to figure it out yet. Any input or suggestion on where to look and/or what to do is greatly appreciated, thanks

This was an issue recently discussed. Its the "Low Order Fee"
Go here and set the "order fee" to $0:
Login to Admin, then Modules --> Order Total , then select "Low Order Fee"

Attachment 20867

13 Jan 2025, 11:09 PM
#526
bigb avatar

bigb

New Zenner

Join Date:
Jun 2024
Posts:
91
Plugin Contributions:
0

Re: Stripe.com payment integration module

split63:

This was an issue recently discussed. Its the "Low Order Fee"
Go here and set the "order fee" to $0:
Login to Admin, then Modules --> Order Total , then select "Low Order Fee"

Attachment 20867

Thank you split63.This fixed the issue. I don't know how long this would have taken me to find. I greatly appreciate your assistance :bigups:

14 Jan 2025, 8:29 PM
#527
split63 avatar

split63

Totally Zenned

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

Re: Stripe.com payment integration module

Gozzandes,
Are you still believing that the issue with non-CC transaction is a session issue?
If so, why are the CC transactions not affected?
I have not had an issue since I turned off all the non-CC payment methods

16 Jan 2025, 8:09 AM
#528
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

split63:

Gozzandes,
Are you still believing that the issue with non-CC transaction is a session issue?
If so, why are the CC transactions not affected?
I have not had an issue since I turned off all the non-CC payment methods

I've read stripe documents for developers.

Following code are external payment page for devido.
the codes are redirect to devido page and back to the confirmation page.
if you want to use gcash, following code will be change from extermal_divido to external_gcash.
I have to check it but I do not use Stripe payment in my EC shop.

elements = stripe.elements({ clientSecret });
elements = stripe.elements({
    clientSecret: clientSecret,
    externalPaymentMethodTypes: ['external_divido']
  });
  paymentElement.mount("#payment-element");
  paymentElement.mount("#payment-element");
// Track selected payment method
let selectedPaymentMethod;
paymentElement.on('change', (event) => {
  selectedPaymentMethod = event?.value?.type;
});
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);
}
async function handleSubmit(e) {
  if (selectedPaymentMethod === 'external_divido') {
    // Redirect customer to the Divido checkout page to complete the transaction
    const dividoRedirectUrl = "<< fill the Divido redirect URL here >>";
    window.location.href = dividoRedirectUrl;
  } else {
  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);
}
}
20 Jan 2025, 7:12 PM
#529
split63 avatar

split63

Totally Zenned

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

Re: Stripe.com payment integration module

V1.5.7c

Over a week ago, I added the session timeout php changes at the end of the tpl_checkout _confirmation_default.php file.
I tested it and it worked great. While on the 3rd checkout page, when the session expired, the page automatically redirected to the session time out page....which by the way, had some generic text statement which did not apply to my site....so it was good I saw that

I then re-enabled Amazon Pay, Cash App, etc...all the non CC payment options.
Then something strange happened. Everyone was paying with CC. No non-CC payments were coming in. Don't know why.

Finally we got an Amazon Pay today. And it caused a duplicate transaction at Stripe and no order at Zen.

The customer claimed the following:

I was on the 3rd checkout page.
Selected Amazon Pay, and then hit “edit” button, to change my address.
This charged me the first time..
Then when i edited the address and I hit “confirm order” it charged me for second time.

Despite the two charges, no Zen Order was received

21 Jan 2025, 12:50 PM
#530
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

The customer goes to the amazon page.
And the customer back to the zen cart page using following code.
But I guess they cannot come back from the amazon page to the zen cart page.
checkout.js 39

    return_url: confirmationURL,

confirmationURL is redirect URL address.
The URL comes from create.php 62

$confirmationURL = '"' . HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . 'index.php?main_page=checkout_confirmation"';

Can you try following code?
checkout.js 39

    return_url: https://YOUR DOMEIN/index.php?main_page=checkout_confirmation,
21 Jan 2025, 1:40 PM
#531
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

Return url is not json encoded.
So script cannot read the PHP return URL

\www\includes\modules\payment\stripepay\create.php line 63
add following code

$jason_confirmationULR = json_encode($confirmationURL);

and rewrite from

    var confirmationURL = JSON.parse('<?php echo $confirmationURL; ?>'); 

to

    var confirmationURL = JSON.parse('<?php echo $jason_confirmationULR; ?>'); 

if it's OK.
could you reply the post?

21 Jan 2025, 3:57 PM
#532
split63 avatar

split63

Totally Zenned

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

Re: Stripe.com payment integration module

The customer further clarified, that when the first charge occurred, he never was directed to Amazon, it was if the "Edit" button for address had a similar effect as the "Confirm order" button. He said that after changing the address and clicking "Confirm Order", he was then redirected to Amazon; that's when the 2nd charge occurred.

21 Jan 2025, 5:32 PM
#533
split63 avatar

split63

Totally Zenned

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

Re: Stripe.com payment integration module

Gozzandes:

Return url is not json encoded.
So script cannot read the PHP return URL

I put the changes on my mirrored test site, which operates in Stripe test mode.
Tried an Amazon Payment
Pressed the "Confirm Order" button and to the left of it appeared this message:

You must provide a return_url when confirming a PaymentIntent with the payment method type amazon_pay.

The transaction appeared on Stripe as "Incomplete"
On Zen, the message disappeared and I remained on the 3rd checkout page as if the "confirm order" button was never pressed

22 Jan 2025, 5:28 AM
#534
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

if you rewrite checkout.jp return_url: confirmationURL, to return_url: https://YOUR DOMEIN/index.php?main_page=checkout_confirmation,
Please revert this code to return_url: confirmationURL,.

I've checked live site using Googlepay.
Payment was made twice, 1st payment is failed and 2nd is succeeded.
And zen cart was also succeeded.
It works everything.
Attachment 20875

22 Jan 2025, 5:30 AM
#535
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

Here's the revised create.php code:

<?php

require '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_PAYMENTSUCCEEDED);
$confirmationURL = '"' . HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . 'index.php?main_page=checkout_confirmation"';
$jason_confirmationURL = json_encode($confirmationURL);

//---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 $jason_confirmationURL; ?>'); 
    var PaymentSuccess = JSON.parse('<?php echo $jason_PaymentSuccess; ?>'); 

</script>
22 Jan 2025, 5:53 AM
#536
gozzandes avatar

gozzandes

Zen Follower

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

Re: Stripe.com payment integration module

The first pi number is created through create.php.
The second pi number is created without going through create.php, so I think it is automatically generated by the Stripe server.
Perhaps the first one was for credit card payment, and the second one was created again to redirect to an external site.
Well, that's just my guess.

22 Jan 2025, 9:36 AM
#537
split63 avatar

split63

Totally Zenned

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

Re: Stripe.com payment integration module

I'm not clear what changes are needed. Does checkout.jp and create.php need to change?

22 Jan 2025, 9:46 AM
#538
split63 avatar

split63

Totally Zenned

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

Re: Stripe.com payment integration module

Gozzandes:

Here's the revised create.php code:
I replaced the contents of create.php with the code you just posted and tried it with Amazon Pay. I did not mess with checkout.jp.
Same issue as before,
I see the message:
You must provide a return_url when confirming a PaymentIntent with the payment method type amazon_pay.

22 Jan 2025, 9:49 AM
#539
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 not clear what changes are needed. Does checkout.jp and create.php need to change?

checkout.js should not be changed, it's should be original line 39 return_url: confirmationURL,.

creat.php line 60 - should be changed

$jason_publishable_key = json_encode($publishable_key);
$jason_PaymentSuccess = json_encode(TEXT_PAYMENT_STRIPE_PAYMENTSUCCEEDED);
$confirmationURL = '"' . HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . 'index.php?main_page=checkout_confirmation"';
$jason_confirmationURL = json_encode($confirmationURL);

//---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 $jason_confirmationURL; ?>'); 
    var PaymentSuccess = JSON.parse('<?php echo $jason_PaymentSuccess; ?>'); 

</script>
22 Jan 2025, 9:59 AM
#540
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 replaced the contents of create.php with the code you just posted and tried it with Amazon Pay. I did not mess with checkout.jp.
Same issue as before,
I see the message:
You must provide a return_url when confirming a PaymentIntent with the payment method type amazon_pay.

following codes are for Amazonpay.
create.php line 34-36 and 42-44
from

        'automatic_payment_methods' => [
        'enabled' => true,
        ],

to

  payment_method_types: ['card', 'amazon_pay'],