#charlche_ece-shipping

1 messages ¡ Page 1 of 1 (latest)

oblique wigeonBOT
#

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

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

wispy yewBOT
#

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.

livid granite
#

@cerulean bison I'm sorry I admit I don't understand the question at all right now. Why do you expect onShippingAddressChanged if it didn't change?

#

charlche_ece-shipping

cerulean bison
#

I don't expect it to be called, but I want to trigger it with an address value I got from somewhere else

livid granite
#

But why? That's impossible since this is not happening in the UI

cerulean bison
#

In order to avoid the 400 bad request I needed to remove the shippingAddressRequired and shippingRates options

#

so now I don't have the UI option but still need the total value before the user clicks pay to be updated

livid granite
#

I'm sorry I wasn't in your previous thread and have no context. I need a clear summary of the issue.
If you remove the shipping collection in the UI then you will never get that callback and have to calculate and set shipping yourself

cerulean bison
#

yup

#

let me send you the previous context

#

there isn't a way to reference the previous thread is there?

livid granite
#

I mean there's a thread but I can't go and read the whole thing. Hopefully you can give a clear summary in 3 sentences at most of what the problem is so I can best help you
But ultimately if you disable shipping collection in ExpressCheckoutElement then there's no shipping callback and no way to do what you are after

cerulean bison
#

This is the error message we were getting: "message": "The shipping information on this PaymentIntent was last set with a secret key and therefore cannot be changed with a publishable key. Please use your secret key instead."

And this is the question I had:
Could we get some help looking into the exact original error in the Stripe API backend for this error? We tried double checking the information being sent to the API to make sure the shipping information and keys are the same and are at a lost for what might be the issue causing us to get a 400 Bad Request error

livid granite
#

Okay, so the solution is to not set shipping at all on the PaymentIntent if you plan to collect this with ExpressCheckoutElement.

cerulean bison
#

yes

#

that was the advice i got yesterday

#

but now the problem is the total amount is no accurate before the user clicks confirm

#

oh i see what you're saying

#

the problem is we are collecting this info for other flows and have no issues, it's just express checkout that is sending the shipping info again

#

*collecting this info on payment intent creation

livid granite
#

yep I get that and so you either

  1. Disable any logic for shipping in ExpressCheckoutElement and do everything yourself including shipping options, total, line items, etc.
  2. Stop putting shipping on the PaymentIntent that you use for ExpressCheckoutElement
cerulean bison
#

got it, when you say do everything myself for shipping options and total and line items, do you mean in our own UI elements not leveraging any react stripe SDK elements?

#

so don't use ExpressCheckoutElement?

livid granite
#

No I didn't mean that, you can still use ExpressCheckoutElement, it all works. But you can't have that support changing the shipping address since you disabled that feature

cerulean bison
#

got it, is there a way for me to update the value highlighted here? If I can do that directly, then I don't need the support for changing the shipping address in ExpressCheckoutElement

livid granite
cerulean bison
#

I think that is because I actually don't know how this works haha

#

where do I initialize ExpressCheckoutElement with the amount?

livid granite
#

did you maybe hardcode amount: 6000 there?

cerulean bison
#

ohhh i see it now

#

It's not hardcoded but I didn't realize that is where it's being set

#

I think that is exactly what I need

#

thank you

#

I will try updating that value

livid granite
#

yay!

cerulean bison
#

thanks again!