Page 63 of 68 FirstFirst ... 13536162636465 ... LastLast
Results 621 to 630 of 679
  1. #621
    Join Date
    Nov 2020
    Posts
    310
    Plugin Contributions
    1

    Default Re: Stripe.com payment integration module

    Quote Originally Posted by barco57 View Post
    includes/modules/payment/stripepay/create.php

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

    Code:
    <?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

  2. #622
    Join Date
    Nov 2020
    Posts
    310
    Plugin Contributions
    1

    Default 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...

    Code:
    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");
      }
    }

  3. #623
    Join Date
    Sep 2004
    Posts
    187
    Plugin Contributions
    0

    Default 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?

  4. #624
    Join Date
    Sep 2004
    Posts
    187
    Plugin Contributions
    0

    Default Re: Stripe.com payment integration module

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

  5. #625
    Join Date
    Sep 2004
    Posts
    187
    Plugin Contributions
    0

    Default Re: Stripe.com payment integration module

    On main_page=checkout_confirmation

    First and last name shows as

    FirstFirst Last

    How to fix?

  6. #626
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,942
    Plugin Contributions
    96

    Default 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/...rior-to-v3.0.0

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

  7. #627
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    934
    Plugin Contributions
    9

    Default Re: Stripe.com payment integration module

    Quote Originally Posted by lat9 View Post
    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/...rior-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.

  8. #628
    Join Date
    Sep 2004
    Posts
    187
    Plugin Contributions
    0

    Default 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

  9. #629
    Join Date
    Sep 2004
    Posts
    187
    Plugin Contributions
    0

    Default Re: Stripe.com payment integration module

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

  10. #630
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,942
    Plugin Contributions
    96

    Default Re: Stripe.com payment integration module

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

 

 
Page 63 of 68 FirstFirst ... 13536162636465 ... LastLast

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