w3c / payment-method-id

Payment Method Identifiers specification
https://w3c.github.io/payment-method-id/
Other
23 stars 20 forks source link

PROPOSAL: Use query string parameters for PMI matching #2

Closed adrianhopebailie closed 8 years ago

adrianhopebailie commented 8 years ago

Background

The current proposal of basic string matching has placed unnecessary restrictions on how PMIs can be used.

Under the current system both of the following PMI's reference the Card Payment Method Specification: https://webpayments.org/card/visa https://webpayments.org/card/mastercard

This is redundant because the PMI is fulfilling two roles:

  1. Identify the payment method that is supported (Card Payment Method)
  2. Pass additional semantics about how that payment method is supported (support for Visa and Mastercard branded cards)

It would be better if a payee or payment app could advertise their support for the card payment method by simply using the PMI; https://webpayments.org/card/ and then use some other mechanism to pass those additional semantics.

Caveat

The mechanism for passing additional semantics needs to be understood by the payment mediator (browser). If the supported card brands was passed in the payment method specific data then it would only be possible to evaluate if there is a match after invoking the payment app.

Proposal

Match PMIs by first matching the URL portion without the query string and then find the intersection of query string parameters treating a missing parameter as a wildcard (match-all).

i.e. The output of the matching algorithm for two URIs will be a new URI that is the intersection of the two inputs

The following table shows illustrative examples: NOTE: Using / instead of a URL to save space, this would normally be a URL

Input 1 Input 2 Output
/ / /
/?schemes=visa,mastercard / /?schemes=visa,mastercard
/?schemes=visa,mastercard /?schemes=visa /?schemes=visa
/?schemes=visa /?schemes=mastercard NO MATCH
/?schemes=visa&type=debit /?schemes=visa,mastercard /?schemes=visa&type=debit
/?type=debit /?schemes=visa,mastercard /?schemes=visa,mastercard&type=debit
/?schemes=visa,mastercard&type=debit /?schemes=visa /?schemes=visa&type=debit
adrianhopebailie commented 8 years ago

Replaced by #5