#chung-yi_best-practices

1 messages ยท Page 1 of 1 (latest)

lament yarrowBOT
#

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

hollow crow
#

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.

mint oar
hollow crow
#

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."

mint oar
lament yarrowBOT
hollow crow
#

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."

mint oar
#

You could ask the customer to choose either to pick up or ship before you render the Express Checkout Element.

hollow crow
#

So now it feels like a deadlock. Or pickup and shipping are just incompatible with Apple Pay.

lunar dagger
#

Hi hi! Iโ€™m going to be taking over for my colleague here.

hollow crow
#

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?

lunar dagger
#

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.

hollow crow
#

Oh good catch! Let me see if not passing shipping at all would work...

lunar dagger
#

Actually a colleague caught it and learned me on it. ๐Ÿ™‚ It should - looking forward to hearing how it goes though. ๐Ÿ™‚

hollow crow
#

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.

lunar dagger
#

Amazing! Exactly - you've got it.

Can you share the request ID of where it didn't require it?

hollow crow
#

The above one req_KEXmGKiW15h0Og was the one, if I understand what you meant.

lunar dagger
#

Was that enough to get you moving forward again on this?

hollow crow
#

Hmm. weird.

#

I don't see shipping in the request but why response has shipping?

lunar dagger
#

Because the Confirmation Token (which presumably came from ECE, right?) had shipping details in it.

hollow crow
#

Yeah I guess that. Hmm then it's not 100% correct.

lunar dagger
#

Tell me more.

hollow crow
#

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.

lunar dagger
#

What happens when you click 'pickup'? Did you do that?

hollow crow
#

yeah, we 're listening to that. Is it possible to nullify shpping address selection when pickup is selected?

lunar dagger
#

No, I meant Shipping Option Change. When you choose between delivery and pickup, that should trigger the Shipping Option event.

hollow crow
#

Just to clarify, we're using Express Checkout Element so I'm not familiar with the Payment Request object you referred to.

#

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.

lunar dagger
#

When they change it, you get a shippingratechange event, right? And you're handling that?

hollow crow
#

Yes.

lunar dagger
#

And if you select pickup, do you still get the shipping data in the Payment Intent?

hollow crow
#

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.

lunar dagger
#

Ya.

#

Ok. Confirmation Tokens are a bit new for me so let me do a bit of reading.

hollow crow
#

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.

lunar dagger
#

I don't think you can change that after it has rendered, no.

#

You can update it.

hollow crow
#

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.

lunar dagger
hollow crow
#

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! ๐Ÿ™

lunar dagger
#

Of course, you're very welcome - we're always here! ๐Ÿ™‚

hollow crow
#

Thanks again!