This document specifies the core Web Payments messages that are used to initiate and acknowledge a payment request. The messages are typically passed between the software ecosystem that inititates, executes, and finalizes Web Payments.
The most effective way to report issues and request features is to engage the working group via the Github issue tracker for the Working Group. Submitting issues as well as pull requests for changes to the specification are encouraged.
When requesting and fulfilling a payment on the Web, a number of messages need to be passed between various parties to execute the movement of funds. This specification details those core messages and provides instructions on how to interpret those messages in a variety of operating environments.
This document is detailed specification for a set of core messages related to initiating, executing, and finalizing payments on the Web. The document is primarily intended for the following audiences:
The terminology in this specification's terminology and messages need to be updated to match the Payments Architecture document.
The data model used for the messages in this specification is intended to be flexible enough to work with a variety of concrete syntaxes. Some of the more formal software designers may find this disconcerting as types and ranges are not strictly locked down at the data model layer. Others will find the need for an abstract data model unnecessary, preferring to express the messages in a more concrete syntax. Some may want to use UML, others may want RDF, and others may prefer JSON's data model. In short, the data model is up for discussion. The only requirement is that we use something that's flexible enough to work with a variety of programming environments while empowering developers to use validation tooling (like JSON Schema) if the facility is available to them.
When designing software systems, the fundamental data model used to express the components of the system is important. Data models tend to vary in their formalism. Some data models are quite abstract. For example, data values are not typed and only vaguely defined as to what their allowable values may be. Other data models are quite formal, with strongly defined value types and ranges.
The data model used to document the messages in this specification tends toward being more abstract and less formal while enabling data validation tools to be utilized if available. This is accomplished by providing the general description of the message in the abstract data model and the allowed value types and ranges via tooling for the concrete syntax (e.g. using JSON Schema for Web Payments Core Messages expressed as JSON).
What follows is a simple example of a
HelloWorld
message definition:
A message that is used to greet the world.
title
message
Note that there are no formal constraints placed on the message definition in the abstract data model. Constraints are typically placed on the values using general techniques available to programming environments for each concrete syntax (e.g. JSON Schema in most JSON environments). These constraints can be found in the sections titled Expressing Messages as WebIDL, Expressing Messages as JSON, and Expressing Messages as JSON-LD.
A FinancialAmount
is used to express a scalar financial
value.
currency
currency
is a string containing a three-character alphaneumeric
code for the currency as defined by [[!ISO4217]] or a URL for a currency
identifier. For example, "USD"
for US Dollars or
"https://example.com/currencies/experimental-XYZ"
for a new
experimental currency.
amount
^-?[0-9]+(\.[0-9]+)?$
.
The following example shows how to represent $55.00 US Dollars.
{ "amount": "55.00", "currency": "USD" }
An AcceptablePaymentMethod
expresses the terms under
which a payment may be fulfilled.
paymentMethod
"VisaLegacy"
or
"https://newnetwork.example.com/methods/SuperCard"
paymentAmount
{ "paymentMethod": ["VisaLegacy", "MasterCardLegacy"], "paymentAmount": { "amount": "4.35", "currency": "USD" }
A PaymentRequest
expresses a payment that is requested
by a payee.
type
"PaymentRequest"
.
"SubscriptionRequest"
to identify payment requests that may
have some recurring quality to them.
description
"Payment for widgets from Acme Anvil Emporium"
.
acceptablePayment
{ "type": "PaymentRequest", "description": "Payment to ExampleMerch for widgets", "acceptablePayment": { "paymentMethod": "VisaLegacy", "paymentAmount": { "amount": "4.35", "currency": "USD" } } };
A PaymentAcknowledgement
expresses the result of processing
a payment request.
type
"PaymentAcknowledgement"
.
Receipt
to identify acknowledgements that contain
receipt information.
description
"Payment to ExampleMerch for widgets"
.
payment
{ "type": "PaymentAcknowledgement", "description": "Payment to ExampleMerch for widgets", "payment": { "paymentMethod": "VisaLegacy", "paymentAmount": { "amount": "4.35", "currency": "USD" }, ... // payment method specific response details here } };
Message |
---|
One proposal for providing message extensibility is to allow messages to
be interpreted as JSON-LD with a specific context, such as
https://example.org/contexts/web-payments/v1
. Doing this would
not only solve message versioning, but it would also enable
decentralized extensibility for all payment messages while ensuring that
there are no clashes in terminology between industry verticals.
There are a variety of ways that message integrity can be protected. Which set of methods will this specification employ.
There are a variety of ways that message replay can be protected against. Which set of methods will this specification employ.
The editor would like to thank the Web Payments Community Group and the Web Payments Working Group.
Thanks to the following individuals, in order of their first name, for their input on the specification: ...