Apple pay - Showing shipping methods in an array

We have had this issue for nearly 1 year now - and any help would be greatly appreciated.

When a customer arrives at the cart they see the Apple pay option and various shipping methods.

Orders over £25 qualify for free 48 hrs delivery and orders over £50 its 24 hrs shipping option.

These are manual shipping methods we have in place and set up for all UK customers.

Our issue is that we also have calculated rates for UPS via Shipstation and easypost and for some reason these appear 1st (Due to the way the ecom platform core code functions) in the apple pay prompt and it auto selects the 1st option and it is a UPS at around £10. As it is an express payment method our customers are maybe in a hurry and they do not notice this and the fact that the shipping method needs to be manually selected even if your order qualifies for free shipping. We are aware that this causes frustration for our customers and a very time consuming process for us as we refund the difference many times a week.

Our developers are stuck and provided the following notes -

I have implemented this sorting using different approaches, but it looks like changing the order of the shipping options is causing an issue with apple pay. I can't properly test the apple pay button. I can reorder the shipping options on the cart page, this seems to work for the regular checkout but it creates a problem with apple pay. I've tried multiple ways to reorder the list here, but it breaks apple pay.

Re the stripe code that the client mentioned - I could be wrong here - but I think shipping options never actually get passed to stripe - only the cart total and the cart items - that's it - null variable for shipping options. There is a changeShippingOptions function in the Stripe code, but i've tested updating the address and shipping options during the cart/checkout process but that part of the code doesn't get called.

Regarding the last point raised, all the shipping methods available do show in the apple pay prompt as they would in the regular checkout, so I am not sure what they mean by this.

This is in contrast to what stripe have advised -

Apologies for the delay in our response on this one, but the shipping options are sequential in the sense that they display in order of how they were passed with the code. Changing your code to include the "free" option first will then make that the default when a customer enters your payment form:

shippingOptions: [ // The first shipping option in this list appears as the default // option in the browser payment interface. {

^^ the code above is an example of this.

A huge show of appreciation to anyone that can provide any advice or suggestions on this.

https://www.waterstreetgallery.co.uk/

This is the stripe script that enables Apple pay In particular the line - var firstShippingOption = shippingOptions[0]; - I think is what is pulling in the options, we just need to tell it to prioritise Some methods over others.

An alteration to the code below was written by our developers that showed the shipping methods in an array but when they replaced it the Apple pay would not complete and after about 25 seconds payment not complete.

Any suggestions would be much appreciated 😀

`

  • Add selected property to shippingMethods. Set it to true for the selection.

    {                         "label": "Paid Shipping",                         "detail": "Arrives in 1 to 2 days",                         "amount": "20.00",                         "identifier": "paidShip",                         "selected": true                     }

Add a Comment

Replies

I'm also having the same issue. Were you able to resolve?

Add selected property to shippingMethods. Set it to true for the selection.


              {
                        "label": "Paid Shipping",
                        "detail": "Arrives in 1 to 2 days",
                        "amount": "20.00",
                        "identifier": "paidShip",
                        "selected": true
                    }

I have been also facing the same issue for the past two weeks but still, I am stuck.

Still, I am stuck. https://trackourshipment.com