Page 1
Payment Request API
Page 3
https://googlechrome.github.io/samples/paymentrequest/
Page 4
Before looking at details of the API, let’s first look at the UI…
Page 6
Click the Buy button…
Page 8
Trusted UI dialog controlled by browser
Page 9
Note the dialog shows the origin/domain that
generated the dialog
Page 10
Note also thatbrowser selects a
default payment method
Page 12
Click the Edit button…
Page 14
Choose amongother available
payment methods
Page 15
Payment instruments shownare the intersection of:
● those the merchant supports● those the user has
Page 16
Other options todisplay to users…
Page 19
Again, the browser chooses a default shipping address, butuser can select among other
shipping addresses
Page 20
What do you think of that UI?
Page 24
Two dictionaries…
Page 25
● “supportedInstruments”● “details”
Page 27
● PaymentMethodData (includes supportedMethods field)
● PaymentDetails (includes total, displayItems, shippingOptions)
Page 28
What do we do with the PaymentMethodData &
PaymentDetails?…
Page 30
What is that code doing?
Page 31
The code calls new PaymentRequest w/ PaymentMethodData and PaymentDetails
to construct a payment request
Page 32
…it then calls .show() method of constructed payment request object
Page 34
PaymentRequest.show() triggers the trusted UI
and returns a Promise…
Page 35
“instrumentResponse”
Page 36
Actually the Promise returned is a…
Page 37
● PaymentResponse which includes a methodName field with the payment method the user chose, along with details
Page 39
PaymentResponse.complete() returns another Promise…
Page 40
After that Promise returns, your web-app code can consume
PaymentResponse.methodName & PaymentResponse.details etc.
Page 42
Other options in the API…
Page 43
● shippingOptions field for PaymentDetails dictionary
● PaymentOptions 3rd arg to constructor (includes (requestShipping field)
Page 45
What about Apple Pay
for the Web?
Page 46
Actually “Apple Pay for the Web” is not “for the Web”…
Page 47
In fact in reality it’s just“Apple Pay for Safari”
Page 48
“Apple Pay for the Web” is a non-standard Apple-only proprietary
API…
Page 49
What are the differences between the Apple Pay for the Web API and the standard Payment Request API?
Page 50
● canMakePayments() and canMakePaymentsWithActiveCard()
● merchant validation
Page 51
Merchant validation
Page 54
Code formerchant validation…
Page 56
canMakePayments() and canMakePaymentsWithActiveCard()
Page 59
Apple Paycode sample
Page 64
What do you think of the Payment Request
API design?
Page 67
Michael[tm] Smith
W3C Deputy Director Keio SFC
[email protected] @sideshowbarker
Page 71
https://w3c.github.io/browser-payment-
api
Page 72
Interface definitions
Page 73
Two objects:● PaymentRequest● PaymentResponse
Page 74
PaymentRequest object
Page 76
Three (dictionary) args for the PaymentRequest constructor…
Page 77
● PaymentMethodData● PaymentDetails● PaymentOptions
Page 81
PaymentResponse object
Page 84
Somewhat out-of-datecall flow for an earlier
version of the API
Page 86
New proposed call flow
Page 88
In that new call flow, the“Mediator” is the Web Browser (UA)
Page 89
What problem arewe trying to solve
With this API?
Page 90
For payments on the Web:
● Make a better user experience● Provide better security
Page 91
Better user experience…
Page 92
Streamline thecheckout experience…
Page 93
Compare to an example of bad user experience
Page 95
That screen shot is from the ticket-buying website for a major theater chain
Page 96
That site is just one exampleof the kind of user-hostile
horrible UX/UI that we want toPayment Request to replace
Page 98
Already implemented in Chrome for Android (dev)
Page 99
Shipping targeted maybefor Chrome 53 on Android
(stable) in “late 2016”
Page 100
Will ship indesktop Chrome in 2017
Page 101
Work in progress onbeing implementedin Microsoft Edge