Results 1 to 10 of 679

Hybrid View

  1. #1
    Join Date
    Jul 2021
    Location
    Fukuoka Japan
    Posts
    132
    Plugin Contributions
    2

    Default Re: Stripe payment module - Triplicate orders

    Quote Originally Posted by split63 View Post
    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.

    Code:
    elements = stripe.elements({ clientSecret });
    Code:
    elements = stripe.elements({
        clientSecret: clientSecret,
        externalPaymentMethodTypes: ['external_divido']
      });

    Code:
      paymentElement.mount("#payment-element");
    Code:
      paymentElement.mount("#payment-element");
    // Track selected payment method
    let selectedPaymentMethod;
    paymentElement.on('change', (event) => {
      selectedPaymentMethod = event?.value?.type;
    });
    Code:
    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);
    }
    Code:
    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);
    }
    }

  2. #2
    Join Date
    May 2010
    Location
    Texas
    Posts
    508
    Plugin Contributions
    0

    Default Re: Stripe payment module - Duplicate charges, no order

    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

  3. #3
    Join Date
    Jul 2021
    Location
    Fukuoka Japan
    Posts
    132
    Plugin Contributions
    2

    Default Re: Stripe payment module - Duplicate charges, no order

    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
    Code:
         return_url: confirmationURL,
    confirmationURL is redirect URL address.
    The URL comes from create.php 62
    PHP Code:
    $confirmationURL '"' HTTPS_SERVER DIR_WS_HTTPS_CATALOG 'index.php?main_page=checkout_confirmation"'
    Can you try following code?
    checkout.js 39
    Code:
         return_url: https://YOUR DOMEIN/index.php?main_page=checkout_confirmation,

  4. #4
    Join Date
    May 2010
    Location
    Texas
    Posts
    508
    Plugin Contributions
    0

    Default Re: Stripe payment module - Duplicate charges, no order

    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.

  5. #5
    Join Date
    Jul 2021
    Location
    Fukuoka Japan
    Posts
    132
    Plugin Contributions
    2

    Default Re: Stripe payment module - Duplicate charges, no order

    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
    PHP Code:
    $jason_confirmationULR json_encode($confirmationURL); 
    and rewrite from
    Code:
        var confirmationURL = JSON.parse('<?php echo $confirmationURL; ?>');
    to
    Code:
        var confirmationURL = JSON.parse('<?php echo $jason_confirmationULR; ?>');
    if it's OK.
    could you reply the post?

  6. #6
    Join Date
    May 2010
    Location
    Texas
    Posts
    508
    Plugin Contributions
    0

    Default Re: Stripe payment module - Duplicate charges, no order

    Quote Originally Posted by Gozzandes View Post
    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

  7. #7
    Join Date
    Jul 2021
    Location
    Fukuoka Japan
    Posts
    132
    Plugin Contributions
    2

    Default Re: Stripe payment module - Duplicate charges, no order

    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.
    Click image for larger version. 

Name:	stripe.jpg 
Views:	68 
Size:	42.6 KB 
ID:	20875

  8. #8
    Join Date
    Jul 2021
    Location
    Fukuoka Japan
    Posts
    132
    Plugin Contributions
    2

    Default Re: Stripe payment module - Duplicate charges, no order

    Here's the revised create.php code:

    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>

  9. #9
    Join Date
    Jul 2021
    Location
    Fukuoka Japan
    Posts
    132
    Plugin Contributions
    2

    Default Re: Stripe payment module - Duplicate charges, no order

    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.

  10. #10
    Join Date
    May 2010
    Location
    Texas
    Posts
    508
    Plugin Contributions
    0

    Default Re: Stripe payment module - Duplicate charges, no order

    Quote Originally Posted by Gozzandes View Post
    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.

 

 

Similar Threads

  1. pay2check.com payment module?
    By sunrise99 in forum Addon Payment Modules
    Replies: 0
    Last Post: 1 Nov 2011, 03:55 AM
  2. klikandpay.com payment module
    By rulest in forum Addon Payment Modules
    Replies: 0
    Last Post: 24 Sep 2010, 06:06 PM
  3. AlertPay Payment Module Integration Help Please!
    By etorf9751 in forum Addon Payment Modules
    Replies: 8
    Last Post: 16 Aug 2010, 05:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg