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.com payment integration module

    [QUOTE=flappingfish;1403574]assuming i added that correctly, it did not work and still states i must provide a return url, provided that section so you can confirm if its me...

    I'm sorry I made a mistake.
    and I cannot check klarna and clearpay payment.

    Code:
      const response = await stripe.confirmPayment({
        elements,
        confirmParams: {
          return_url: confirmationURL,
         },
        redirect: 'if_required'
       }
      )

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

    Default Re: Stripe.com payment integration module

    [QUOTE=Gozzandes;1403575]
    Quote Originally Posted by flappingfish View Post
    assuming i added that correctly, it did not work and still states i must provide a return url, provided that section so you can confirm if its me...

    I'm sorry I made a mistake.
    and I cannot check klarna and clearpay payment.

    Code:
      const response = await stripe.confirmPayment({
        elements,
        confirmParams: {
          return_url: confirmationURL,
         },
        redirect: 'if_required'
       }
      )
    That did the trick nicely, all working as expected as far as I can test, klarna and clearpay are loading as expected and card payments are working. Will have to wait until someone uses klarna or clearpay to confirm it indeed processes the order correctly upon successful finance application. It has made a big difference to sales already though, every man and his dog knows the name stripe, i think people distrusted the takepayments branded payment module i was using :)

  3. #3
    Join Date
    Nov 2020
    Posts
    310
    Plugin Contributions
    1

    Default Re: Stripe.com payment integration module

    [QUOTE=flappingfish;1403577]
    Quote Originally Posted by Gozzandes View Post

    That did the trick nicely, all working as expected as far as I can test, klarna and clearpay are loading as expected and card payments are working. Will have to wait until someone uses klarna or clearpay to confirm it indeed processes the order correctly upon successful finance application. It has made a big difference to sales already though, every man and his dog knows the name stripe, i think people distrusted the takepayments branded payment module i was using :)
    just had a pair of customers come in and use klarna for instore collection and the payment plans where setup and payment succeeded but it did not then register the payment success and directed to the "payment success" message above the payment form but pressing confirm demands fresh payment, no way to confirm the order after payment success :/

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

    Default Re: Stripe.com payment integration module

    [QUOTE=flappingfish;1403578]
    Quote Originally Posted by flappingfish View Post

    just had a pair of customers come in and use klarna for instore collection and the payment plans where setup and payment succeeded but it did not then register the payment success and directed to the "payment success" message above the payment form but pressing confirm demands fresh payment, no way to confirm the order after payment success :/

    Could you please give me a few weeks?
    Please try using version 2.0.5 temporarily. I think klarna works with this version, but it creates two payments, one incomplete and one successful.

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

    Default Re: Stripe.com payment integration module

    Could you try following code?

    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 {
        showMessage(`Payment Succeeded: ${response.paymentIntent.id}`);
    
      }
      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 = 'Payment succeeded!.';
          document.getElementById("btn_submit").click();
          showMessage("Payment succeeded!");
          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. #6
    Join Date
    Jul 2021
    Location
    Fukuoka Japan
    Posts
    132
    Plugin Contributions
    2

    Default Re: Stripe.com payment integration module

    It does not work.
    sorry.
    Could you give me a few weeks?
    and Try version 2.0.5.

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

    Default Re: Stripe.com payment integration module

    Could you try following code?

    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 {
        showMessage(`Payment Succeeded: ${response.paymentIntent.id}`);
        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 = 'Payment succeeded!.';
          showMessage("Payment succeeded!");
          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");
      }
    }

 

 

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