#microchungus_best-practices

1 messages · Page 1 of 1 (latest)

twin sapphireBOT
#

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

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

night belfry
#

Hi, are you able to add more context on 'I don't want them to be able to check out with a 'free' placeholder rate.'? What so you mean exactly?

twin sapphireBOT
gray valve
#

Sure.

  • I have to provide a non-empty shippingRates
  • The ShippingRate type requires a number
  • apple pay displays 0 as free
  • I don't have a real shipping rate until the user has entered an address
    What is the best practice for handling this situation? is my "Calculating shipping .... Free" the best I can do?
#

I do have a followup question which appears to be a bug but I can wait on that

manic peak
#

Yeah passing in 0 as a placeholder is the right way

#

Because once customer enters their address, you can show an accurate value

gray valve
#

So if the UI for some reason tries to automatically select the option (which does say 'free') I can consider that a no-op, but

  • I cannot tell apple pay to make the option unselectable (like a disabled radio input on web)
  • I cannot tell apple pay that the order cannot be completed (like saying ready=false to avoid the touch id appearing)
  • I cannot change the fact that apple pay will call this 'free'
manic peak
#

Correct

gray valve
#

Alright, I have a followup question. The event for a shipping address change only includes a partial address without the line 1/2 of the address [type definitions here]. I need this address to fetch shipping quotes for certain items, as well as to calculate taxes. Our shipping quote service has said they cannot guarantee anything without the full address. Does this mean we can't enable apple pay/express checkout for orders requiring custom shipping quotes?

GitHub

Loading wrapper for Stripe.js. Contribute to stripe/stripe-js development by creating an account on GitHub.

manic peak
#

It's a security feature

#

Not sure what provider you're using to calculate quotes

#

But full address shouldn't be necessary

#

We provide the minimum necessary fields to do this

twin sapphireBOT
gray valve
#

OK. And one final question that I haven't seen an answer to:

<Elements stripe={stripePromise} options={options}>
  <ExpressCheckoutUI order={orderData} />
</Elements>

In this react code the Elements options contains the total amount for checkout and ExpressCheckoutUI contains the callback logic for handling all of these events. Do I need to include some callback hook like onOrderTotalUpdate={ (amount) => setNewOrderAmount(amount) } To change the value of the order as these are filled in? I haven't gotten to this step yet so I might find the answer out on my own.

turbid oxide
gray valve
#

wonderful and easy. thanks.

#

In our case our shipping quotes come from a very custom provider so we'll have to work with them or otherwise exclude their orders from this checkout flow. Thanks, I'll come back with more questions if they arise!

turbid oxide
#

Sounds good!

gray valve
#

One final question about calculating taxes without full address: Are there not cases where sales taxes can depend on the street address?

#

In general it seems strange (I realize this is apple pay and not stripe) that I can never pause or reject an action, like to say 'oops... before confirming the order please verify the new sales tax/shipping total'). If i call reject() from any handler the whole flow is just gone.

turbid oxide
#

Yes there are cases where the street address will result in a different sales tax calculation, if just the state and zip is used.