W3C home > Mailing lists > Public > public-payments-wg@w3.org > February 2016

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

From: Manu Sporny <notifications@github.com>
Date: Tue, 02 Feb 2016 10:45:58 -0800
To: w3c/webpayments <webpayments@noreply.github.com>
Message-ID: <w3c/webpayments/issues/27/178752652@github.com>
@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):

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:
Received on Tuesday, 2 February 2016 18:46:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:43:14 UTC