Re: [w3c/browser-payment-api] Support for gift cards and discount codes (#145)

> What is the strategy for accepting gift card and discount codes in the payments api? Will this be the responsibility of the user agent or the payment app?

It seems to me that this would be easily supported by leveraging the user agent's data collection functionality as with shipping address etc.

This is further evidence that this functionality needs to be extensible.

Should we allow websites to request data that the user agent doesn't necessarily understand? 
Should we update my proposal on PR #65 to give the website more control over what is being requested?

WebIDL
```
enum DataType {
  "date",
  "number",
  "address",
  "email",
  "telephone",
  "url"
  "string",
  ...
};

dictionary DataDescriptor {
  required DOMString label;
  required DataType type;
  required boolean optional = false;
};

dictionary ShippingAddressDataDescriptor : DataDescriptor {
  sequence<ShippingOption> shippingOptions = false;
};

dictionary PaymentOptions {
  sequence<DataDescriptor> requestData;
  ...
};
```

Example website code:

```javascript
{
  requestData: [
    {
      label: "Shipping Address",
      type: "address",
      shippingOptions: [...]
    }, 
    {
      label: "Email Address",
      type: "email",
      optional: true
    }, 
    {
      label: "Voucher Code",
      type: "string",
      optional: true
    }
  ] 
}

```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/issues/145#issuecomment-212430457

Received on Wednesday, 20 April 2016 13:44:53 UTC