#dawid_error

1 messages ยท Page 1 of 1 (latest)

hardy prawnBOT
peak ravineBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

hardy prawnBOT
#

๐Ÿ‘‹ 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/1239881376178634843

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

gaunt nebula
#

Succeeded one pi_3PGI5iLgTfxsYzuG0BTW03rC

#

But for failed ones we don't have PI yet

fickle plaza
#

Are you able to find an example intent that that failed? Without that I can't find the root error

gaunt nebula
#

We actually create PI after whole payment process so we don't have ones

#

Any of this can help?

fickle plaza
#

Can you share your ECE code

gaunt nebula
#

It's Id from above?

fickle plaza
#

No, the code you use to initialise the ECE and handle the confirm/click events that result in the error

gaunt nebula
#

Not sure I understand

We initialize it like this

payment.stripe.instance.elements({
      mode: 'payment',
      locale: 'en',
      currency: checkout.summary.totalPrice.currency.toLowerCase(),
      paymentMethodTypes,
      amount: formatStripeAmount(checkout.summary.totalPrice),
      appearance,
      loader: 'never',
      fonts: getFonts(theme),
    })

...

    const element = paymentElements.create('expressCheckout', {
      buttonHeight: 44,
      buttonTheme: {
        applePay: buttonColor,
        googlePay: buttonColor,
      },
      buttonType: {
        applePay: 'plain',
        googlePay: 'plain',
      },
      layout: {
        maxColumns: 0,
        maxRows: 0,
        overflow: 'never',
      },
      wallets: {
        applePay: 'always',
        googlePay: 'always',
      },
    })

    expressCheckoutElement.on('confirm', handleConfirm)

#

The error is before modal confirm so we basically never initialize payments on our backend

fickle plaza
#

OK, and what does handleConfirm function look like?

gaunt nebula
#

But we never reach this point for failed cases

But simplified version of this fn is

const handleConfirm = (event) => {

updatePaymentMutation.mutate(
    {
        ....
    },
    {
        onSuccess: async (data) => {
            const paymentData = getPaymentData(data)

            const paymentIntentResponse = await payment.stripe.instance?.confirmPayment({
                elements: paymentElements,
                clientSecret: paymentData.paymentId,
                confirmParams: {
                    return_url: window.location.href,
                    shipping: getShippingDetails(paymentData),
                    payment_method_data: {
                        billing_details: getBillingDetails(paymentData),
                    },
                },
                redirect: 'if_required',
            })

            navigate(reverse(routes.checkout, { checkoutId, stepId: 'payment' }))
        },
        onError: (error) => {
            cancelPaymentMutation.mutate()
            event.paymentFailed()
            handlePaymentError(error, false)
        },
    })};

fickle plaza
gaunt nebula
#
 const handleClick = (event) => {
      addExpressCheckoutInfoMutation.mutate({
        displayedExpressMethods: displayedPaymentMethods || [],
        selectedExpressMethod: event.expressPaymentType,
      })

      // @ts-ignore this is not typed in @types/stripe-v3
      paymentElements?.update({
        setupFutureUsage: getSetupFutureUsage(event.expressPaymentType),
        currency: checkout?.summary?.totalPrice
          ? checkout?.summary?.totalPrice.currency.toLowerCase()
          : undefined,
        amount: checkout?.summary?.totalPrice
          ? formatStripeAmount(checkout.summary.totalPrice)
          : undefined,
      })

      event.resolve({
        allowedShippingCountries: countryOptions
          .filter(({ disabled }) => !disabled)
          .filter(({ value }) => !notSupportedExpressCheckoutCountries.includes(value))
          .map(({ value }) => value),
        billingAddressRequired: true,
        emailRequired: true,
        phoneNumberRequired: true,
        shippingAddressRequired: true,
        business: {
          name: shopSettings?.checkout?.shop?.creatorName || '',
        },
        lineItems: getExpressLineItems(checkout),
        shippingRates: getExpressShippingRates(checkout),
      })
    }
fickle plaza
#

Are there any errors in the browser console?

#

The screenshot implies there should be an error response somewhere, I'd expect that to be in the console/network tab

#

My guess is that one of the parameters in the event.resolve of your click handler are invalid. Maybe business[name] can't be an empty string or something? Hard to say without seeing the actual JSON payload

peak ravineBOT
gaunt nebula
#

Let me try to check actually json
I see nothing in console

gaunt nebula
#

Object that is passed to resolve โ˜๏ธ

main lion