<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "ApplePayontheWeb",
  "identifier" : "/documentation/ApplePayontheWeb/ApplePaySession/onshippingmethodselected",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Apple Pay on the Web"
    ],
    "preciseIdentifier" : "instp/ApplePaySession/onshippingmethodselected"
  },
  "title" : "onshippingmethodselected"
}
-->

# onshippingmethodselected

An event handler to call when the user selects a shipping method.

```
attribute EventHandler onshippingmethodselected;
```

## Discussion

This attribute must be set to a function that accepts an `events` argument; for example, `session.onshippingmethodselected = function(event) {}`.

The event parameter contains the [`shippingMethod`](/documentation/ApplePayontheWeb/ApplePayShippingMethodSelectedEvent/shippingMethod) attribute.

The [`onshippingmethodselected`](/documentation/ApplePayontheWeb/ApplePaySession/onshippingmethodselected) function must respond by calling [`completeShippingMethodSelection`](/documentation/ApplePayontheWeb/ApplePaySession/completeShippingMethodSelection) before the 30 second timeout, after which a message appears stating that the payment could not be completed.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)