Re: [w3c/browser-payment-api] Should the API support field validation? (#225)

We can also add validation errors to `PaymentDetails`, so that merchant can notify the browser during `shippingaddresschange` event.

```javascript
payment.addEventListener('shippingaddresschange', function(evt) {
  evt.updateWith(new Promise(function(resolve) {
    if (payment.shippingAddress.postalCode === '99999') {
      details.validationErrors = [{field: 'postalCode', message: 'Example site does not support shipping to postal code 9999'}];
    } else {
      delete details.validationErrors;
    }
    resolve(details);
  }));
});
```

---
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/225#issuecomment-238322087

Received on Monday, 8 August 2016 21:25:11 UTC