Abstract

This specification defines payment method identifiers and how they are validated, and, where applicable, minted and formally registered with the W3C. Other specifications (e.g., the Payment Request API) make use of these identifiers to facilitate monetary transactions on the web platform.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

The working group will demonstrate implementation experience by creating a test suite and having at least two independent implementations pass each mandatory test (i.e., each test the corresponds to a MUST requirement of the specification). The working group hopes to demonstrate, in the form of an implementation report, interoperability from two or more vendors on both mobile and desktop web browsers.

There has been no change in dependencies on other workings groups during the development of this specification.

Note

Please file any issues with this specification in the payment method identifiers repository on GitHub.

This document was published by the Web Payments Working Group as a Working Draft. This document is intended to become a W3C Recommendation.

Please see the Working Group's implementation report.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 March 2017 W3C Process Document.

1. Payment method identifiers

A payment method identifier is either a:

1.1 Validity

The steps to validate a payment method identifier with a string pmi are given by the following algorithm. It returns true if the pmi is valid.

  1. Let url be the result of running the basic URL parser with pmi.
  2. If url is failure, validate a standardized payment method identifier with pmi and return the result.
  3. Otherwise, validate a URL-based payment method identifier passing url and return the result.

2. URL-based payment method identifiers

A URL-based payment method identifier is a URL that is valid as per the steps to validate a URL-based payment method identifier.

Note

Developers wanting to use a URL-based payment method identifier for a third party payment handler are encouraged to read the Payment Method Best Practice document.

2.1 Validation

The steps to validate a URL-based payment method identifier are given by the following algorithm. The algorithm takes a URL url as input and returns true if the URL is valid:

  1. If url's scheme is not "https", return false.
  2. If url's username or password is not the empty string, return false.
  3. Otherwise, return true.
Example 1: valid and invalid identifiers
const valid = [
  {
    supportedMethods: "https://example.com/pay",
  },
  {
    supportedMethods: "https://example.com/pay?version=1",
  },
  {
    supportedMethods: "https://example.com/pay/version/1",
  },
];

const invalid = [
  {
    // ❌ Uses http://, a username, and a password.
    supportedMethods: "http://username:password@example.com/pay",
  },
  {
    // ❌ Uses unknown URI scheme.
    supportedMethods: "unknown://example.com/pay",
  },
];

2.2 Comparison

User agents MUST perform comparisons of URL-based payment method identifiers using equals. [URL]

2.3 Fetching (dereferencing)

It is OPTIONAL for user agents to fetch a URL-based payment method identifier.

3. Standardized payment method identifiers

A standardized payment method identifier is a string that represents a standardized payment method and is valid as per the steps to validate a standardized payment method identifier.

User agents MAY support zero or more standardized payment method identifiers listed in section 4. Registry of standardized payment methods .

3.1 Validity

The steps to validate a standardized payment method identifier are given by the following algorithm. The algorithm takes a string as input and returns true if the identifier is valid:

  1. Return true if string contains only [UNICODE] code points:
    1. In the range U+0061-U+007A ("Latin Small Letter A" to "Latin Small Letter Z")
    2. In the range U+0030-U+0039 ("Digit Zero" to "Digit Nine").
    3. Zero or more U+002D HYPHEN-MINUS (-).
  2. Otherwise, return false.
Note

When minting a new standardized payment method identifier for the purpose of standardization, be sure that it conforms to the following regular expression: [a-z0-9-]+.

Note

When used in an API, the following method identifiers are all ignored by the user agent. Some user agents might inform developers that identifiers are invalid to help them fix issues.

Example 2: Valid and invalid identifiers
const valid = [
  {
    supportedMethods: "basic-card",
  },
];

const invalid = [
  {
    // ❌ Contains Unicode character outside the valid ranges.
    supportedMethods: "basic-💳",
  },
  {
    // ❌ Contains uppercase characters.
    supportedMethods: "Basic-Card",
  },
  {
    // ❌ Contains Unicode characters outside the valid ranges.
    supportedMethods: "¡basic-*-card!",
  },
];

3.2 Comparison

For standardized payment method identifiers, user agents MUST compare strings in a case-sensitive manner (code point for code point).

4. Registry of standardized payment methods

This section is non-normative.

Note

A standardized payment method is a payment method that has undergone standardization at the W3C, and is listed in this registry.

The Working Group has minted the following standardized payment method identifiers:

"basic-card"
The Basic Card Payment specification.

5. Privacy and security consideration

There are no known privacy or security concerns to be taken into considerations at this time.

A. References

A.1 Normative references

[HTML]
HTML Standard. Anne van Kesteren; Domenic Denicola; Ian Hickson; Philip Jägenstedt; Simon Pieters. WHATWG. Living Standard. URL: https://html.spec.whatwg.org/multipage/
[UNICODE]
The Unicode Standard. Unicode Consortium. URL: http://www.unicode.org/versions/latest/
[URL]
URL Standard. Anne van Kesteren. WHATWG. Living Standard. URL: https://url.spec.whatwg.org/
[WHATWG-FETCH]
Fetch Standard. Anne van Kesteren. WHATWG. Living Standard. URL: https://fetch.spec.whatwg.org/

A.2 Informative references

[payment-method-basic-card]
Basic Card Payment. Adrian Bateman; Zach Koch; Roy McElmurry; Marcos Caceres. W3C. 27 July 2017. W3C Working Draft. URL: https://www.w3.org/TR/payment-method-basic-card/
[payment-request]
Payment Request API. Adrian Bateman; Zach Koch; Roy McElmurry; Domenic Denicola; Marcos Caceres. W3C. 15 August 2017. W3C Working Draft. URL: https://www.w3.org/TR/payment-request/