oncouponcodechanged
An event handler called by the system when the user enters or updates a coupon code.
Declaration
attribute EventHandler oncouponcodechanged;Discussion
Set this attribute to a function with one parameter that contains an ApplePayCouponCodeChangedEvent. This function processes the coupon code update, and then calls completeCouponCodeChange with the results.
The code below shows adding a listener for the coupon code changed event to the Apple Pay session:
// Add a listener for the couponcodechanged event to the Apple Pay session.
session.addEventListener("couponcodechanged", function(event) {
var newCode = event.couponCode;
// Process the coupon code.
...
// Call the Apple Pay session completion method for this event.
session.completeCouponCodeChange({
// Update the payment request with any changed information.
newTotal: ...
});
});