---
title: onpaymentmethodselected
framework: applepayontheweb
role: symbol
role_heading: Instance Property
path: applepayontheweb/applepaysession/onpaymentmethodselected
---

# onpaymentmethodselected

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

## Declaration

```data
attribute EventHandler onpaymentmethodselected;
```

## Discussion

Discussion This attribute must be set to a function that accepts an events argument; for example, session.onpaymentmethodselected = function(event) {}. The event parameter contains the paymentMethod attribute. Access it like this: var myPaymentMethod = event.paymentMethod; The onpaymentmethodselected function must respond by calling completePaymentMethodSelection before the 30 second timeout, after which a message appears stating that the payment could not be completed.

## See Also

### Handling payment method updates

- [completePaymentMethodSelection](applepayontheweb/applepaysession/completepaymentmethodselection.md)
- [ApplePayPaymentMethodUpdate](applepayontheweb/applepaypaymentmethodupdate.md)
- [ApplePayPaymentMethodSelectedEvent](applepayontheweb/applepaypaymentmethodselectedevent.md)
- [ApplePayPaymentMethod](applepayontheweb/applepaypaymentmethod.md)
