#chung-yi_best-practices
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/1359263848061735122
๐ 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.
- chung-yi_best-practices, 22 hours ago, 27 messages
One workaround would be setting the shipping address as the store location for pickup orders, when creating/confirming the payment intent. But that feels a misuse of that shipping field to me.
Hi, can you share the request id where you saw this error when creating/ confirming the intent? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Looking
Here is one example in test mode: req_lpHquzIRBUtC1L
I assume the shipping address is required is because the Express Checkout Element on the client side was configured with shippingAddressRequired: true
And we probably can't (conditionally) set shippingAddressRequired: false when pickup is selected because we'll run into the integration error: "You must specify shippingAddressRequired: true when providing shippingRates."
If you're passing that on the client-side, https://docs.stripe.com/js/elements_object/create_express_checkout_element#express_checkout_element_create-options-shippingAddressRequired yeah that is required on the server-side call. With ApplePay, the customer can change the shipping address on the UI no? I'm unsure what the specific issue is exactly. Are you able to reword the specific issue here?
Yes. We offer pickup as one of the fulfillment options. In Apple Pay (Express Checkout Element) implementation, we pass pickup as one of the shipping rates. Since it's pickup, there is no shipping address and confirming payment on the server gives us that "Missing required param: shipping[address]." error.
We can't make the shipping address optional, because setting shippingAddressRequired: false on the Express Checkout Element gives us the integration error: "You must specify shippingAddressRequired: true when providing shippingRates."
You could ask the customer to choose either to pick up or ship before you render the Express Checkout Element.
So now it feels like a deadlock. Or pickup and shipping are just incompatible with Apple Pay.
Hi hi! Iโm going to be taking over for my colleague here.
Right. Or pickup and shipping can't be combined together.
Hi @lunar dagger ๐
Would like to double check with you about the deadend situation we're facing with pickup and shipping rendered together in Express Checkout Element.
They seem just technically incompatible, or is there actually a way to achieve that?
Hi! So it looks like you've passed in shipping[name] in your request and if you pass any shipping details at all, then you must, at least, provide both shipping[name] and some components of shipping[address] as well.
Oh good catch! Let me see if not passing shipping at all would work...
Actually a colleague caught it and learned me on it. ๐ It should - looking forward to hearing how it goes though. ๐
Ohhh it passed this time: req_KEXmGKiW15h0Og
Okay so the shipping was required was not because on the Express Checkout Element we set shippingAddressRequired: true. It was because we passed partial shipping data.
So now it seems setting shippingAddressRequired: true on the Express Checkout Element does not make shipping required when creating/confirming a payment intent.
Amazing! Exactly - you've got it.
Can you share the request ID of where it didn't require it?
The above one req_KEXmGKiW15h0Og was the one, if I understand what you meant.
I see the shipping details on the payment intent. If you scroll down to the bottom you'll see them here: https://dashboard.stripe.com/test/logs/req_KEXmGKiW15h0Og
Was that enough to get you moving forward again on this?
Because the Confirmation Token (which presumably came from ECE, right?) had shipping details in it.
Yeah I guess that. Hmm then it's not 100% correct.
Tell me more.
Because the Apple Pay dialog still keeps the shipping address selection, even when "pickup" is selected from the shipping rate options. When pickup is selected, the shipping address is irrelevant.
Like the screenshot above.
What happens when you click 'pickup'? Did you do that?
Also, are you listening for / handling this event? https://docs.stripe.com/js/payment_request/events/on_shipping_option_change
I guess you meant this event? https://docs.stripe.com/js/elements_object/express_checkout_element_shippingratechange_event
yeah, we 're listening to that. Is it possible to nullify shpping address selection when pickup is selected?
No, I meant Shipping Option Change. When you choose between delivery and pickup, that should trigger the Shipping Option event.
Just to clarify, we're using Express Checkout Element so I'm not familiar with the Payment Request object you referred to.
It seems the Payment Request Button is deprecated. https://docs.stripe.com/stripe-js/elements/payment-request-button
I think what we need here is, when pickup is selected from the shipping rates, we want to ignore the "ship to" address selected. But I'm not sure how to achieve that with the dialog.
When they change it, you get a shippingratechange event, right? And you're handling that?
Yes.
And if you select pickup, do you still get the shipping data in the Payment Intent?
We're doing a deffered payemnt intent approach. An intent won't get created until submitting from the Express Checkout Element.
So I guess the shipping data, as you mentioned, just came from the UI/confirmation token.
Thank you!
I wonder if it's possible to dynamically update shippingAddressRequired: false when pickup is selected. Or that's a static thing we can't change after rendering.
https://docs.stripe.com/js/confirmation_tokens/create_confirmation_token#create_confirmation_token-options-params-shipping There's some narrative around shipping and the Address Element (are you using that?) but beyond that, is there still actually an issue left?
Seems you do get shippingwhen you need it, and you know when you don't need it so it doesn't matter at that point, right?
I don't think you can change that after it has rendered, no.
You can update it.
Yeah, but now I'm thinking about it, we'll run into the integration error above on the client side: "You must specify shippingAddressRequired: true when providing shippingRates."
We want to disregard the shipping data when pickup is selected. I wonder if we can unset shipping when creating the confirmation token, as you pointed above.
You could also reject inside the event: https://docs.stripe.com/js/elements_object/express_checkout_element_shippingaddresschange_event#express_checkout_element_on_shipping_address_change-handler-reject
...in the case where it doesn't match what they input at the start.
OK. will test a few things out. Will probably need to step out shortly. Thank you for your help! Will reach out again tomoroow if still need help! ๐
Of course, you're very welcome - we're always here! ๐
Thanks again!