An event handler that is called when a shipping contact is selected in the payment sheet.
SDKs
- Safari Desktop 10.0+
- Safari Mobile 10.0+
Framework
- Apple Pay JS
Declaration
attribute Event Handler onshippingcontactselected;
Discussion
This attribute must be set to a function that accepts an events
argument; for example,
session
.
The event
parameter contains the shipping
attribute. Access this attribute using the event
parameter, for example,
var my
The onshippingcontactselected
function must respond by calling complete
before the 30 second timeout, after which a message appears stating that the payment could not be completed.
The shipping
attribute contains the information you requested by specifying required
in Apple
.
Before the user authorizes the transaction, you receive redacted shipping contact information in a callback event. The redacted information includes only the necessary data for completing transaction tasks, such as calculating taxes or shipping costs.
An example of redacted shipping contact information
{
"locality": "Cupertino",
"country": "United States",
"postalCode": "95014",
"administrativeArea": "CA",
"countryCode": "us"
}
Note
The data returned may differ based on the user's geographic region. For Canada and United Kingdom, a redacted shipping address contains only the first three characters of the postal code. For US addresses, the redacted zip code contains the first five digits.
The full postal code is provided after the user authorizes the transaction.