paymentShippingAddressInvalidError(withKey:localizedDescription:)
Creates a shipping address error with the supplied key and user-facing error message.
Declaration
class func paymentShippingAddressInvalidError(withKey postalAddressKey: String, localizedDescription: String?) -> any ErrorParameters
- postalAddressKey:
A key value from Cnpostaladdress that indicates which part of the address has an error.
- localizedDescription:
Optional. Provide a localized, user-facing error message string to help the user resolve the error.
Discussion
You can use this convenience method to create a payment error object instead of creating an NSError object yourself. This convenience method indicates an error in the shipping address received from an Apple Pay sheet.
The error you provide and its optional message appear on the Apple Pay sheet. The available space to display messages is limited, so you should keep your messages concise.
For example, the following example shows how to create errors for indicating problems with the zip code and street, using the keys CNPostalAddressPostalCodeKey and CNPostalAddressStreetKey.
Creating custom errors:
See Also
Providing error information
paymentBillingAddressInvalidError(withKey:localizedDescription:)paymentContactInvalidError(withContactField:localizedDescription:)paymentShippingAddressUnserviceableError(withLocalizedDescription:)paymentCouponCodeInvalidError(localizedDescription:)paymentCouponCodeExpiredError(localizedDescription:)