#awo_ece-confirm

1 messages · Page 1 of 1 (latest)

stable stagBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1440364765565423676

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

ashen copper
#

hi there, can you give me an example Payment Intent ID (pi_1234) that you're experiencing this problem with?

humble bay
#

pi_3SUqX0FSXSPNg8P81thmep7c

ashen copper
humble bay
#

i use the whole express checkout element, do i have to make that seperate for every possible payment option (klarna, paypal, ..) ? my compaarable code looks like this ``` const { error } = await stripe.confirmPayment({
clientSecret: clientSecret,
confirmParams: {
shipping: {
name: shippingAddress.name,
address: {
line1: shippingAddress.address.line1,
city: shippingAddress.address.city,
country: shippingAddress.address.country,
postal_code: shippingAddress.address.postalCode,
state: shippingAddress.address.state,
}
},
return_url: ${window.location.origin}/complete,
},
});

    if (error) {
        setMessage(`Zahlungsfehler nach Bestätigung: ${error.message}`);
    } else {
         setMessage("Zahlung initiiert. Wenn kein Fenster geöffnet wurde, ist die Weiterleitung blockiert.");
    }```
ashen copper
#

yes, Klarna has a similar method called stripe.confirmKlarnaPayment()

humble bay
#

i tried like this but it gives me same result

ashen copper
#

can you share the part of your code that is calling stripe.confirmPayPalPayment() ?

humble bay
#
const handleExpressCheckoutConfirm = async ({ paymentMethod, shippingAddress, shippingRate }) => {
        
        setIsLoading(true); 
        setMessage(null);

        if (!clientSecret) {
            setMessage("Error: Client Secret fehlt. Bitte die Warenkorbseite neu laden.");
            setIsLoading(false);
            return;
        }

        if (!stripe || !elements) {
            setMessage("Error: Stripe/Elements nicht initialisiert.");
            setIsLoading(false);
            return;
        }
        
        if (!paymentMethod || paymentMethod.type !== 'paypal') {
             setMessage("Error: PayPal Zahlungsmethode wurde nicht korrekt bereitgestellt.");
             setIsLoading(false);
             return;
        }

        const {error} = await stripe.confirmPayPalPayment(
        '{{PAYMENT_INTENT_CLIENT_SECRET}}',
        {
            return_url: `${window.location.origin}/complete`,
        }
        );

        if (error) {
            setMessage(`Zahlungsfehler nach Bestätigung: ${error.message}`);
        } else {
             setMessage("Zahlung initiiert. Wenn kein Fenster geöffnet wurde, ist die Weiterleitung blockiert.");
        }
        
        setIsLoading(false); 
    };```
ashen copper
#

you need to change '{{PAYMENT_INTENT_CLIENT_SECRET}}' to pass in the client secret from the Payment Intent creation

humble bay
#

still no redirect

#
        const {error} = await stripe.confirmPayPalPayment(
        clientSecret,
        {
            return_url: `${window.location.origin}/complete`,
        }
        );```
ashen copper
#

any errors in your console? or output from that setMessage() function?

humble bay
#

no

ashen copper
#

have you confirmed that stripe.confirmPayPalPayment() is actually getting called? try adding some console logs around it just to make sure the code is progressing to that point

humble bay
#
console.log('1')


    // 1. LOGIK FÜR EXPRESS CHECKOUT
    const handleExpressCheckoutConfirm = async ({ paymentMethod, shippingAddress, shippingRate }) => {
        
        console.log('2')

        setIsLoading(true); 
        setMessage(null);

        if (!clientSecret) {
            setMessage("Error: Client Secret fehlt. Bitte die Warenkorbseite neu laden.");
            setIsLoading(false);
            return;
        }

        if (!stripe || !elements) {
            setMessage("Error: Stripe/Elements nicht initialisiert.");
            setIsLoading(false);
            return;
        }
        
        if (!paymentMethod || paymentMethod.type !== 'paypal') {
             setMessage("Error: PayPal Zahlungsmethode wurde nicht korrekt bereitgestellt.");
             setIsLoading(false);
             return;
        }

        const {error} = await stripe.confirmPayPalPayment(
        clientSecret,
        {
            return_url: `${window.location.origin}/complete`,
        },

        console.log('3')

        );

        if (error) {
            setMessage(`Zahlungsfehler nach Bestätigung: ${error.message}`);
        } else {
             setMessage("Zahlung initiiert. Wenn kein Fenster geöffnet wurde, ist die Weiterleitung blockiert.");
        }
        
        setIsLoading(false); 
    };
``` console log 1 gets called three times, console log 2 only one time when i enter my paypal details and log 3 doesnt show at all
stable stagBOT
warm terrace
#

👋 Taking over this thread, catching up now

#

Sorry for the confusion. For Express Checkout Element, stripe.confirmPayment() should work for all the supported wallet payment methods. You shouldn't need to integrate the payment method individually.

when i use expresscheckoutelement and enter my correct sandbox information in the paypal window, it closes, but keeps my site on freeze and tells me to proceed with my payment in the open paypal window or use another method.
Could you share the full code of which you integrate the Express Checkout Element with the onConfirm handler, handleExpressCheckoutConfirm?

humble bay
#

glad to hear that:D

warm terrace
#

Are you following this guide for your Express Checkout Element integration? https://docs.stripe.com/elements/express-checkout-element/accept-a-payment?payment-ui=elements

Express Checkout Element uses deferred intent flow, which you'd need to set the payment amount and currency in the options of Elements. There are some configurations that aren't set up correctly:

  1. The elementsOptions should mode, currency and amount: https://docs.stripe.com/elements/express-checkout-element/accept-a-payment?payment-ui=elements#set-up-elements
  2. clientSecret shouldn't be set elementsOptions

Could you try if this will fix the issue?

humble bay
#

still have the issue, ```
// CHANGED THIS
// const elementsOptions = {
// clientSecret: clientSecret,
// appearance: appearance,
// };

// TO THAT
const elementsOptions = {
    mode: 'payment',
    amount: 2000,
    currency: 'usd',
    appearance: appearance,
};```
warm terrace
#

Could you share your development website, so that I can take a look what actually happens?

stable stagBOT
sinful matrix
#

awo_ece-confirm