Re: [webpayments] How should the message schemas for the payment request and response be defined? (#27)

@ianbjacobs, here's a proposal that might work:

* The Web Payments API uses messages that look like JSON to the average Web developer (but are in-fact, JSON-LD - nothing is "undefined behavior" and the rules for extensibility are clear).
* The spec does not require the browser to interpret the Web Payments API messages as JSON-LD (the behavior is hard-coded for the pieces that the browser has to process). This means that browsers can treat the bits of the JSON-LD that they use as plain 'ol JSON.
* If a JSON-LD Context is not defined, one must be assumed (the Web Payments Version 1.0 JSON-LD Context).

This would mean that a web developer could express a payment request like this (for example):

```javascript
var request = {
  type: 'PaymentRequest',
  description: 'Payment to ExampleMerch for widgets',
  acceptablePayment: {
    paymentMethod: 'https://visa.com/payment-methods#Visa',
    transfer: {
      amount: '4.35',
      currency: 'USD'
    }
  }
};
```

... it can be treated as regular JSON by Web Developers and the browser vendors (that is, they can hard-code to it without giving up on the extensibility story of JSON-LD).

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webpayments/issues/27#issuecomment-178752652

Received on Tuesday, 2 February 2016 18:46:33 UTC