#ellsva_error
1 messages ¡ Page 1 of 1 (latest)
đ 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/1298242344260341855
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- ellsva_error, 21 minutes ago, 34 messages
We close threads after ~30 minutes of inactivity. What's the issue?
Had a look at the old thread. Are you calling elements.update() anywhere? Does the amount value change in your integration after you intialise via elements.create()?
Yeah sorry missed the last message. No we're not calling it ourselves, we're not calling elements.create() anywhere either
are you able to scroll up the thread and see the file I sent recently? There I send the file where we use it
Yes, I read the thread
You're using React yes, the provider calls elements.create() under the hood
To confirm, the error is thrown when the Element is initialised, or after a certain action? Beyond some kind of reproduction somewhere this will be hard for us to debug
Nothing has changed at this end nor are there other reports of this, which points to some kind of integration issue
It seems to be triggered after an interaction with it. We can see that a user has touched the payment element
ok good to know
This is basucally what we're doing
const stripeClient = getStripe();
const amount = find(checkout.summary_items, { type: 'total' })?.total;
const currency = checkout.price.currency.iso_code.toLowerCase();
if (!stripeClient || !amount || !currency) {
throw new MentiError('Could not fetch Stripe client, amount or currency', { feature: 'checkout' });
}
return (
<Elements stripe={stripeClient}
options={{
mode: 'subscription',
paymentMethodTypes,
amount,
currency
}}
>
)
So we know we have the currency and the amount when calling the Element
I would assume that amount is an invalid value at some point
But don't you agree that this error message "Invalid value for PaymentRequest update(): total.amount should be a positive amount in the currency's subunit. You specified: 14388." is weird? Because the amount is 14388?
Hard to confirm without any context
If it would be undefined, minus or whatever we would see that in the error message I would think
But the error we get from you shows that the amount looks legit, that's confusing for me đ¤
I'm looking at the code internally that throws this error and essentially it's only thrown is amount is value is negative. Looks like you have some useCheckout hook that is what returns the data that amount is computed from. Could it not be that the value is initially returned negative or something? I can't account for why the error message is confusing, agree it doesn't make sense
Again, a reproduction of this issue would be helpful
throw new MentiError('Could not fetch Stripe client, amount or currency', {
feature: 'checkout',
});
}```
This part especially is problematic as a negative number is considered truthy
"Could it not be that the value is initially returned negative or something" - if that would be the case I think you would show that minus number in the log right?
That's a good point, that is something we can improve and see if stops the logs from happening
Again I would love to show you how to reproduce it, but he haven't been able to do so - we can just see that random customers have this issue
I don't know, maybe? I would assume so yes. But again, really hard to help debug this without a clear reproduction. The code looks mostly fine (without full context)
I think we can definitely improve that check to make sure its a legit amount (positive). But what makes me think this is not the issue is that the number we see in the log are the plan prices, and the customers are able to go through the checkout - even if they are in a session where this error has been thrown
meaning that the price is retrieved correctly from the BE
I'm trying to reproduce it locally still
Yeah beyond a reproduction this is going to be difficult for us to debug I'm afraid. Is this actually impact checkout/payments in your integration?
Sorry I don't understand the question "Is this actually impact checkout/payments in your integration?" âşď¸
Like, the error. Is it preventing your customers from paying/completing checkout or is it just noise?
No as I said it doesn't seem like it is blocking any user from purchasing which is good. We are just very confused that this started happening a lot after Saturday. We've had 89 events since then so still alarming for us
hi! I'm taking over this thread.
could you share a link with reproduction steps so I would see that issue myself?
Hi! As I've explained before we have not been able to reproduce it unfortunately. https://mentimeter.com/app/checkout/pro is the checkout where this error is being thrown
what is weird is that we've never seen this error, and now they are just storming in since saturday (91 right now). And the error says "Invalid value for PaymentRequest update(): total.amount should be a positive amount in the currency's subunit. You specified: 14388." and the number shown here is always positive
From what I can see on our tracking for our users they come to our checkout and this error is alerted. Before I said that it was always when a customer interacted with the payment element, but seems unrelated.
We have this check
if (!stripeClient || !amount || !currency) {
throw new MentiError('Could not fetch Stripe client, amount or currency', {
feature: 'checkout',
});
}
And we now added
if (!stripeClient || (amount && amount <= 0) || !amount || !currency) {
throw new MentiError('Could not fetch Stripe client, amount or currency', {
feature: 'checkout',
});
}
And we will see if that improves it
got it, but that makes it tricky to debug.
I would recommend to add as much logging on your end to try to understand when exactly that error ocurs (maybe it's a specific browser, or a specific action from the use?). Then share all your findings to Stripe supports while including your code. And they will be investigate this in more details. https://support.stripe.com/contact