I'd like to add custom error message to ApplePay when shipping address is invalid. We have following code (that shows generic error message)
applePay.session.completeShippingContactSelection(
ApplePaySession.STATUS_FAILURE,
[],
{ label: "error", amount: "1" },
[],
);
According to Apple's documentation, they introduced new error type on ApplePay version 3 (we use version 3). So I tried following code:
applePay.session.completeShippingContactSelection(
{
errors: [ { code: "shippingContactInvalid", contactField: "postalCode", message: "ZIP Code is invalid" }],
newShippingMethods: [],
newTotal: { label: "error", amount: "1", type: "pending" },
newLineItems: [],
}
);
However I get an error at runtime - TypeError type error
. Error is not displayed.
How can I display custom error message?