#swaroopnagothi25_api

1 messages ยท Page 1 of 1 (latest)

edgy flintBOT
#

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

๐Ÿ“ 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.

maiden pelican
#

Hi ๐Ÿ‘‹

Can you explain what you are doing?

#

Like, the validation errors should not destroy the payment element instance

#

Or do you mean you are passing invalid args to stripe.elements() when initializing without an intent?

tacit ermine
#

I implemented payment element in my custom checkout page. In my checkout page, i can change my payment amount whenever i need. so initially my payment amount will be 0. as soon as i select the product in my checkout page, the payment amount will get updated.

maiden pelican
tacit ermine
#

do i have to reload payment element as soon as there is a change to my payment amount?

#

this is happening when the payment amount is chnaged from 0 to some postive value.

maiden pelican
#

That first error suggests that something in your front-end integration is destroying the Stripe element that has been created.

#

Are you using React?

tacit ermine
#

yes

maiden pelican
#

So in that case it's likely that React is destroying/recreating something in response to the user changing the amount. You should refactor your integration to avoid that.

tacit ermine
#

sorry. i didn't get that can you give me an example?

maiden pelican
#

Okay, when i see errors like this they are almost always due to how React handles reactivity. I'm not a React developer so I'm not super familiar with it but basically, you have your UI set to update when certain values change using a hook like useEffect . Part of that update destroys and recreates the Stripe <PaymentElement> or it's parent elements.

This means that, when something is updated on your site, you destroy the initialized Payment Element and your code cannot interact with it anymore

tacit ermine
#

Hooo ok.

edgy flintBOT
tacit ermine
#

So for now, I am reintializing the payment element when there is a change to my payment amount.

#

Even I don't have much knowledge on react. But i think, it is not the right way to reinitialize the stripe each time.

#

Is there any one from your team can help to resolve the issue? if possible.

wide nest
#

That keeps the same elements instance but updates the amount that the payment element expects and passes to things like the Apple Pay payment sheet

tacit ermine
#

ok let me try.

#

is clientSecret mandatory?

wide nest
#

It is mandatory if you are confirming the payment intent on the client side. The frontend needs to know which intent is being confirmed

tacit ermine
#

i added payment Element to component. and I am rendering it when there is change to my payment amount.

#

Here StripePaymentForm is my custom component and i have added paymentElement inside it.

#

paymentAmount && (<StripePaymentForm amount={paaymentAmount}/>)

wide nest
#

and I am rendering it when there is change to my payment amount.
Not quite clear on what this means, can you tell me more about it? Calling that update call shouldn't require re-rendering components as far as I am aware.
And that null error should be similar to other null errors, you will want to double check whether elements is being unset somehow. Your code likely sets that variable at somepoint using the useElements hook like in this doc https://docs.stripe.com/sdks/stripejs-react#useelements-hook

tacit ermine
#

ook i will try this out. can you tell me how payment method configuartion works?

wide nest
tacit ermine
#

if i create a payment intent with ``automatic_payment_methods = {enabled: true}

#

if a account has 5 payment method configurations. which one will pcik by the payment Inetnt

wide nest
tacit ermine
#

if one stripe customer is connected to my ecommece site, then will there a new payment method configuration created?

wide nest
#

To clarify, are you talking about a customer as in someone who is paying you? Or are you talking about someone with a Stripe account that is connected to your Stripe account? We typically call those "Customers" and "Accounts" respectively

tacit ermine
#

about someone with a Stripe account that is connected to your Stripe account

wide nest
#

That depends which connect charge flow you are using. If you are using a flow where the payment intent is created on your platform account, then it uses PMCs from your account. If you are using the direct charges flow where you create the intents on the connected account, or if you use on_behalf_of then it is a PMC that is on the connected account.

tacit ermine
#

hoo ok

#

in our case we create the intents on the connected account

wide nest
tacit ermine
#

ok. this confihuration will get applied to all my connected accounts right.

wide nest
#

Correct

tacit ermine
#

so a connected account can have only one payment method configuration?

#

sorry, we can have, it give me a option to create a new configuration.

#

lets say if my connect account has 2 pmcs, then which one will be the parent to all my connected accounts?

edgy flintBOT
solemn ermine
#

Hello
taking over as pompey needs to step away soon

#

If you allow your connected accounts to manage their own payment methods via the dashboard then they might have different config as well. Otherwise, it should be just the one you create as a platform.

tacit ermine
#

Ok

#

How can I know the default configuration from the list of configurations

solemn ermine
#

Do you mean via the dashboard or the API?

#

The dashboard adds a tag or something (don't remember 100%)

tacit ermine
#

But when I make a get call it is showing all the configurations is_default aa true