A dictionary that defines a payment modifier for a specific payment type.
- Safari Desktop 11.1+
- Safari Mobile 11.1+
- Apple Pay JS
In the Payment Request API, modifiers contain transaction details that apply only when certain conditions are met. For example, a modifier could be a surcharge for paying with a credit card. The transaction includes the modifier's details, and the payment sheet displays the surcharge, only if the user pays with a credit card.
With Apple Pay, use
Apple to define display items based on a user's choice of payment method type:
store. When the user selects their payment method, the transaction invokes the modifier corresponding to the payment method, and displays the information in the payment sheet.
The following example shows a modifier that applies a surcharge when the customer uses a credit card. The modifier's
additional applies only if the user's chooses to use a credit card and is using Apple Pay.
Notice that the modifier also contains a total, which overwrites the payment request's total when applying the modifier. The payment sheet itself does not perform any calculations. You are responsible for supplying all values, including calculating new totals within modifiers.The payment sheets displays the values you provide.