#charlche_ece-shipping
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/1230281513023701076
đ 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.
- charlche_error, 1 day ago, 25 messages
@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
I don't expect it to be called, but I want to trigger it with an address value I got from somewhere else
But why? That's impossible since this is not happening in the UI
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
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
yup
let me send you the previous context
there isn't a way to reference the previous thread is there?
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
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
this is the payment intent: https://dashboard.stripe.com/test/payments/pi_3P60NUFdV4bT3T5F10r0rpit
Okay, so the solution is to not set shipping at all on the PaymentIntent if you plan to collect this with ExpressCheckoutElement.
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
yep I get that and so you either
- Disable any logic for shipping in ExpressCheckoutElement and do everything yourself including shipping options, total, line items, etc.
- Stop putting
shippingon the PaymentIntent that you use for ExpressCheckoutElement
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?
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
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
You can use https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#display-line-items I think to show a break down, have you tried that?
I also don't fully get why you have initialized ExpressCheckoutElement with the wrong amount if you already know it?
I think that is because I actually don't know how this works haha
where do I initialize ExpressCheckoutElement with the amount?
oh, it's where you do this https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#set-up-elements
mode: 'payment',
amount: 1099,
currency: 'usd',
// Customizable with appearance API.
appearance: {/*...*/},
};
// Set up Stripe.js and Elements to use in checkout form
const elements = stripe.elements(options);```
did you maybe hardcode amount: 6000 there?
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
yay!
thanks again!