#ellsva_error

1 messages · Page 1 of 1 (latest)

nimble scaffoldBOT
#

👋 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/1298216957358637086

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

sacred junco
#

👋 happy to help

#

would you mind sharing a link to your website where this is happening?

#

were you able to replicate in test mode as well?

gray wasp
#

Thanks! We have unfortunately not been able to reproduce it, we can just see that it's being triggered sometimes when customers are interacting with the payment element. This is the link to our checkout https://mentimeter.com/app/checkout/pro

#

Only way we've been able to reproduce the error itself is hardcoding the amount to something negative in our code

sacred junco
#

unfortunately if there's no reproduction steps and an accessible test environment where it's reproducible then I can't really help you troubleshoot this

#

I'm most probably sure it's an issue with your backend code passing a wrong value somehow

gray wasp
#

But isn't the fact that we're getting the error message "Invalid value for PaymentRequest update(): total.amount should be a positive amount in the currency's subunit. You specified: 14388." weird? It's obviously not a negative amount 🤔

sacred junco
#

hmmm

gray wasp
#

How is 14388 not a valid amount? It is our price, so the BE is passing the correct amount ☺️

sacred junco
#

yes it is a bit weird

#

what element are you using?

#

the PaymentRequestButton?

gray wasp
#

PaymentElement

sacred junco
#

PaymentRequest update()

#

would you mind sharing the code that is throwing this error?

gray wasp
#

When we're calling

import { Elements } from '@stripe/react-stripe-js';

<Elements
  stripe={stripeClient}
  options={{
    mode: 'subscription',
    paymentMethodTypes,
    amount,
    currency,
    locale: localeToStripeElementLocale(i18n.language),
    // Fully customizable with appearance API.
    appearance: {
      variables: {
        colorBackground: theme.colors.inputBgActive,
        colorText: theme.colors.text,
        colorTextPlaceholder: theme.colors.textWeak,
        colorPrimary: isInCheckoutVDLSplit ? theme.colors.info : blueBase,
        spacingGridColumn: '4px',
        spacingGridRow: '8px',
        fontSizeBase: '16px',
        fontFamily: 'MentiText, sans-serif',
        borderRadius: '12px',
        iconColor: theme.colors.info,
        iconChevronDownColor: theme.colors.text,
      },
      labels: 'floating',
    },
  }}
>

and change the amount to for instance -12 then we get this error. We're never calling PaymentRequest update() ourselves

sacred junco
#

and change the amount to for instance -12 then we get
would you mind sending me this line of code?

gray wasp
#

Instead of sending “amount” inte the element above do “amount: -12”

sacred junco
#

ok how are you getting the amount/currency

#

what's the code that is calling this

#

is it possible that somehow amount is being undefined or null or 0 at some point? until you await your response from the API?

gray wasp
#

No we’re checking that we have both the currency and amount before we call this code. So it will always be valid

sacred junco
#

I really need to see the code

#

I'm trying to help you blindly here

gray wasp
#

I’m not sure what code you want to see. I’m not gate keeping on purpose I just don’t know what to show you. The backend call is returning an amount, like 1488, and a currency, like EUR

sacred junco
#

the react code with your different useEffects etc...

nimble scaffoldBOT
opaque panther
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

nimble scaffoldBOT
gray wasp
opaque panther
#

Is there a test website that we can reproduce the issue please ?