@@ -1860,6 +1860,75 @@ <h2>
1860
1860
modify the < a > PaymentDetailsBase</ a > based on a < a > payment method
1861
1861
identifier</ a > . It contains the following members:
1862
1862
</ p >
1863
+ < p >
1864
+ When presenting a payment request to an end-user, if there are multiple
1865
+ < a > PaymentDetailsModifier</ a > dictionaries in a sequence for the same
1866
+ < a > payment method identifier</ a > , then the user agent MUST use the
1867
+ first entry to match a < a > payment method identifier</ a > as its
1868
+ modifier.
1869
+ </ p >
1870
+ < div class ="note ">
1871
+ < p >
1872
+ In the following example, the developer has included multiple
1873
+ < a > PaymentDetailsModifier</ a > for the same payment method identifier
1874
+ ("basic-card"). In such a case, the user agent chooses the first
1875
+ matching modifier. However, the second modifier would be still be
1876
+ used for by the payment handler for "https://example.com/bobpay".
1877
+ </ p >
1878
+ < pre class ="example js " title ="Multiple modifiers ">
1879
+ const modifiers = [
1880
+ // This one will be used a for "basic-card" payment, when paying
1881
+ // with a "Example Card" credit card...
1882
+ {
1883
+ supportedMethods: ["basic-card"],
1884
+ total: {
1885
+ currency: "USD",
1886
+ value: "80.00",
1887
+ },
1888
+ additionalDisplayItems: [
1889
+ {
1890
+ label: "ExampleCard loyalty discount, 20% off!",
1891
+ amount: {
1892
+ currency: "USD",
1893
+ value: "-20.00",
1894
+ },
1895
+ },
1896
+ ],
1897
+ data: {
1898
+ supportedTypes: ["credit"],
1899
+ supportedNetworks: ["example-card"],
1900
+ },
1901
+ },
1902
+ // In the following, "basic-card" is ignored because only
1903
+ // the first "basic-card" above will match. However,
1904
+ // users of the "example.com/bobpay" payment handler
1905
+ // wishing to pay with an "Example Card" credit card
1906
+ // will receive the 30% discount.
1907
+ {
1908
+ supportedMethods: ["basic-card", "https://example.com/bobpay"],
1909
+ total: {
1910
+ currency: "USD",
1911
+ value: "70.00",
1912
+ },
1913
+ additionalDisplayItems: [
1914
+ {
1915
+ label: "ExampleCard loyalty discount, 30% off!",
1916
+ amount: {
1917
+ currency: "USD",
1918
+ value: "-30.00",
1919
+ },
1920
+ },
1921
+ ],
1922
+ data: {
1923
+ supportedTypes: ["credit"],
1924
+ supportedNetworks: ["example-card"],
1925
+ },
1926
+ },
1927
+ ];
1928
+ const options = { modifiers };
1929
+ const request = new PaymentRequest(methods, details, options);
1930
+ </ pre >
1931
+ </ div >
1863
1932
< dl >
1864
1933
< dt >
1865
1934
< dfn > supportedMethods</ dfn > member
0 commit comments