From e930e0d2fd8cfbd0237601d763b2808811e268ca Mon Sep 17 00:00:00 2001 From: Ade Bateman Date: Fri, 16 Sep 2016 22:44:54 -0700 Subject: [PATCH 1/3] Support collection of payer name without shipping address. Apple's API supports collection of name as well as email, phone, and postal address. --- index.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/index.html b/index.html index 954d4604..2e45fa21 100644 --- a/index.html +++ b/index.html @@ -810,6 +810,7 @@

PaymentDetailsModifier dictionary

PaymentOptions dictionary

 dictionary PaymentOptions {
+  boolean requestPayerName = false;
   boolean requestPayerEmail = false;
   boolean requestPayerPhone = false;
   boolean requestShipping = false;
@@ -824,6 +825,12 @@ 

PaymentOptions dictionary

The following fields MAY be passed to the PaymentRequest constructor:

+
requestPayerName
+
+ This boolean value indicates whether the user agent should collect and return + the payer's name as part of the payment request. For example, this would be set to + true to allow a merchant to make a booking in the payer's name. +
requestPayerEmail
This boolean value indicates whether the user agent should collect and return @@ -979,6 +986,7 @@

PaymentResponse interface

readonly attribute object details; readonly attribute PaymentAddress? shippingAddress; readonly attribute DOMString? shippingOption; + readonly attribute DOMString? payerName; readonly attribute DOMString? payerEmail; readonly attribute DOMString? payerPhone; @@ -1014,6 +1022,12 @@

PaymentResponse interface

passed to the PaymentRequest constructor, then shippingOption will be the id attribute of the selected shipping option.
+
payerName
+
+ If the requestPayerName flag was set to true in the PaymentOptions + passed to the PaymentRequest constructor, then payerName will + be the name provided by the user. +
payerEmail
If the requestPayerEmail flag was set to true in the PaymentOptions @@ -1428,6 +1442,11 @@

User accepts the payment request algorithm

is true, then copy the shippingOption attribute of request to the shippingOption attribute of response. +
  • + If the requestPayerName value of request@[[\options]] + is true, then set the payerName attribute of + response to the payer's name provided by the user. +
  • If the requestPayerEmail value of request@[[\options]] is true, then set the payerEmail attribute of From 702fc25c3df691f9a759b15aaac2d1486610aa4a Mon Sep 17 00:00:00 2001 From: Ade Bateman Date: Fri, 16 Sep 2016 22:50:57 -0700 Subject: [PATCH 2/3] Add pending field to PaymentItem Apple's API allows merchants to indicate when a line item is not yet final. --- index.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.html b/index.html index 2e45fa21..75abcb0c 100644 --- a/index.html +++ b/index.html @@ -859,6 +859,7 @@

    PaymentItem dictionary

    dictionary PaymentItem { required DOMString label; required PaymentCurrencyAmount amount; + boolean pending = false; };
  • @@ -876,6 +877,13 @@

    PaymentItem dictionary

    A PaymentCurrencyAmount containing the monetary amount for the item.
    +
    pending
    +
    + When set to true this flag means that the amount field is not final. + This is commonly used to show items such as shipping or tax amounts that depend upon + selection of shipping address or shipping option. User agents MAY indicate pending + fields in the user interface for the payment request. +
    From 26b642c256fb5b32d65b5b87a59ff4b3d3ea999f Mon Sep 17 00:00:00 2001 From: Ade Bateman Date: Fri, 16 Sep 2016 23:12:12 -0700 Subject: [PATCH 3/3] Add support for shipping type in the user interface Apple's API allows the page to influence how the shipping address is described. --- index.html | 57 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 75abcb0c..c2f829cf 100644 --- a/index.html +++ b/index.html @@ -234,6 +234,7 @@

    PaymentRequest interface

    readonly attribute PaymentAddress? shippingAddress; readonly attribute DOMString? shippingOption; + readonly attribute PaymentShippingType? shippingType; /* Supports "shippingaddresschange" event */ attribute EventHandler onshippingaddresschange; @@ -253,7 +254,8 @@

    PaymentRequest interface

    - The shippingAddress and shippingOption attributes + The shippingAddress, shippingOption, + and shippingType attributes are populated during processing if the requestShipping flag is set.

    @@ -421,6 +423,20 @@

    PaymentRequest constructor

  • Set the value of the shippingOption attribute on request to null.
  • +
  • + Set the value of the shippingType attribute on request to null. +
  • +
  • + If options.requestShipping is set to true, then set the value of the + shippingType attribute on request to options.shippingType. + If options.shippingType is not a valid PaymentShippingType value + then set the shippingType attribute on request to "shipping". +
    + This behavior allows a page to detect if it supplied an unsupported shipping type. This will be + important if new shipping types are added to a future version of this specification but a page is + run in a user agent supporting an earlier version. +
    +
  • If the details.shippingOptions sequence contains multiple PaymentShippingOption objects that have the same id, @@ -809,12 +825,19 @@

    PaymentDetailsModifier dictionary

    PaymentOptions dictionary

    -dictionary PaymentOptions {
    -  boolean requestPayerName = false;
    -  boolean requestPayerEmail = false;
    -  boolean requestPayerPhone = false;
    -  boolean requestShipping = false;
    -};
    +        enum PaymentShippingType {
    +          "shipping",
    +          "delivery",
    +          "pickup"
    +        };
    +
    +        dictionary PaymentOptions {
    +          boolean requestPayerName = false;
    +          boolean requestPayerEmail = false;
    +          boolean requestPayerPhone = false;
    +          boolean requestShipping = false;
    +          PaymentShippingType shippingType = "shipping";
    +        };
           

    @@ -850,6 +873,26 @@

    PaymentOptions dictionary

    true when physical goods need to be shipped by the merchant to the user. This would be set to false for an online-only electronic purchase transaction. +
    shippingType
    +
    + Some transactions require an address for delivery but the term "shipping" isn't appropriate. + For example, "pizza delivery" not "pizza shipping" and "laundry pickup" not "laundry shipping". + If requestShipping is set to true, then the shippingType + field may be used to influence the way the user agent presents the user interface for + gathering the shipping address. +

    The PaymentShippingType supports the following values:

    +
    +
    shipping
    +
    This is the default and refers to the address being collected as the destination for shipping.
    +
    delivery
    +
    This refers to the address being collected as being used for delivery. This is commonly + faster than shipping. For example, it might be used for food delivery.
    +
    pickup
    +
    This refers to the address being collected as part of a service pickup. For example, + this could be the address for laundry pickup.
    +
    +

    The shippingType field only affects the user interface for the payment request.

    +